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