| Conditions | 4 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | 10 | public function __invoke(array $tries) : int |
|
| 8 | { |
||
| 9 | 10 | $punctuation = 0; |
|
| 10 | |||
| 11 | 10 | foreach ($tries as $num_try => $try) |
|
| 12 | { |
||
| 13 | 10 | if ($this->isATryWithStrike($try)) |
|
| 14 | { |
||
| 15 | 3 | $current_punctuation = 10 + $tries[$num_try+1] + $tries[$num_try+2]; |
|
| 16 | 3 | $punctuation+= $current_punctuation; |
|
| 17 | 3 | continue; |
|
| 18 | } |
||
| 19 | |||
| 20 | 10 | if ($this->isAFrameWithSpare($tries, $num_try)) |
|
| 21 | { |
||
| 22 | 2 | $current_punctuation = 10 + $tries[$num_try+2]; |
|
| 23 | |||
| 24 | 2 | $punctuation+=$current_punctuation; |
|
| 25 | 2 | continue; |
|
| 26 | } |
||
| 27 | |||
| 28 | 10 | $punctuation+= $try; |
|
| 29 | } |
||
| 30 | |||
| 31 | 10 | return $punctuation; |
|
| 32 | } |
||
| 33 | |||
| 44 |