| Conditions | 5 |
| Paths | 8 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 46 | public function assess(string $contents): int |
||
| 47 | { |
||
| 48 | $tokens = \token_get_all($contents); |
||
| 49 | $score = 0; |
||
| 50 | foreach ($tokens as $token) { |
||
| 51 | if (\is_array($token)) { |
||
| 52 | $score += $this->getComplexity($token[0]); |
||
| 53 | |||
| 54 | continue; |
||
| 55 | } |
||
| 56 | if ('?' !== $token) { |
||
| 57 | continue; |
||
| 58 | } |
||
| 59 | |||
| 60 | $score += 1; |
||
| 61 | } |
||
| 62 | |||
| 63 | return 0 === $score |
||
|
|
|||
| 64 | ? 1 |
||
| 65 | : $score; |
||
| 66 | } |
||
| 96 |