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