Conditions | 4 |
Paths | 5 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
9 | 32 | public static function computeErasingLengths(array $strings): int |
|
10 | { |
||
11 | 32 | if (empty($strings)) { |
|
12 | 7 | return 0; |
|
13 | } |
||
14 | 25 | $lengths = []; |
|
15 | 25 | foreach ($strings as $string) { |
|
16 | 25 | $lengths[] = self::computeErasingLength($string); |
|
17 | } |
||
18 | 25 | if (1 !== count(array_unique($lengths))) { |
|
19 | 1 | throw new \InvalidArgumentException('Strings have different erasing lengths.'); |
|
20 | } |
||
21 | 24 | return $lengths[0]; |
|
22 | } |
||
42 |