Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 2 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
13 | public function transform(string $name): int |
||
14 | { |
||
15 | $number = -1; |
||
16 | |||
17 | foreach (str_split(string: $name) as $char) { |
||
18 | $digit = ord(character: $char) - 65; |
||
19 | if ($digit < 0) { |
||
20 | break; |
||
21 | } |
||
22 | |||
23 | $number = ($number + 1) * 26 + $digit; |
||
24 | } |
||
25 | |||
26 | return $number; |
||
27 | } |
||
29 |