@@ -9,7 +9,7 @@ class BowlingGame extends Kata implements Executable
9
9
/**
10
10
* The number of frames in a game.
11
11
*/
12
- const FRAMES_PER_GAME = 10 ;
12
+ public const FRAMES_PER_GAME = 10 ;
13
13
14
14
/**
15
15
* All rolls for the game.
@@ -31,7 +31,8 @@ public function execute(...$arguments)
31
31
/**
32
32
* Roll the ball.
33
33
*
34
- * @param int $pins
34
+ * @param int $pins
35
+ *
35
36
* @return void
36
37
*/
37
38
public function roll (int $ pins ): void
@@ -53,7 +54,7 @@ public function score()
53
54
if ($ this ->isStrike ($ roll )) {
54
55
$ score += $ this ->pinCount ($ roll ) + $ this ->strikeBonus ($ roll );
55
56
56
- $ roll += 1 ;
57
+ ++ $ roll ;
57
58
58
59
continue ;
59
60
}
@@ -73,29 +74,32 @@ public function score()
73
74
/**
74
75
* Determine if the current roll was a strike.
75
76
*
76
- * @param int $roll
77
+ * @param int $roll
78
+ *
77
79
* @return bool
78
80
*/
79
81
protected function isStrike (int $ roll ): bool
80
82
{
81
- return $ this ->pinCount ($ roll ) === 10 ;
83
+ return 10 === $ this ->pinCount ($ roll );
82
84
}
83
85
84
86
/**
85
87
* Determine if the current frame was a spare.
86
88
*
87
- * @param int $roll
89
+ * @param int $roll
90
+ *
88
91
* @return bool
89
92
*/
90
93
protected function isSpare (int $ roll ): bool
91
94
{
92
- return $ this ->defaultFrameScore ($ roll ) === 10 ;
95
+ return 10 === $ this ->defaultFrameScore ($ roll );
93
96
}
94
97
95
98
/**
96
99
* Calculate the score for the frame.
97
100
*
98
- * @param int $roll
101
+ * @param int $roll
102
+ *
99
103
* @return int
100
104
*/
101
105
protected function defaultFrameScore (int $ roll ): int
@@ -106,7 +110,8 @@ protected function defaultFrameScore(int $roll): int
106
110
/**
107
111
* Get the bonus for a strike.
108
112
*
109
- * @param int $roll
113
+ * @param int $roll
114
+ *
110
115
* @return int
111
116
*/
112
117
protected function strikeBonus (int $ roll ): int
@@ -117,7 +122,8 @@ protected function strikeBonus(int $roll): int
117
122
/**
118
123
* Get the bonus for a spare.
119
124
*
120
- * @param int $roll
125
+ * @param int $roll
126
+ *
121
127
* @return int
122
128
*/
123
129
protected function spareBonus (int $ roll ): int
@@ -128,7 +134,8 @@ protected function spareBonus(int $roll): int
128
134
/**
129
135
* Get the number of pins knocked down for the given roll.
130
136
*
131
- * @param int $roll
137
+ * @param int $roll
138
+ *
132
139
* @return int
133
140
*/
134
141
protected function pinCount (int $ roll ): int
0 commit comments