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 | 33 | public static function computeErasingLength(array $strings): int |
|
10 | { |
||
11 | 33 | if (empty($strings)) { |
|
12 | 7 | return 0; |
|
13 | } |
||
14 | 30 | $lengths = []; |
|
15 | 30 | foreach ($strings as $string) { |
|
16 | 30 | $lengths[] = self::erasingLen($string); |
|
17 | } |
||
18 | 30 | if (1 !== count(array_unique($lengths))) { |
|
19 | 1 | throw new \InvalidArgumentException('Strings have different erasing lengths'); |
|
20 | } |
||
21 | 29 | return $lengths[0]; |
|
22 | } |
||
56 |