Total Complexity | 4 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class MapTransform |
||
10 | { |
||
11 | /** |
||
12 | * @param $map |
||
13 | * @return string|string[]|null |
||
14 | */ |
||
15 | 4 | public static function run($map) |
|
16 | { |
||
17 | 4 | $map = str_replace(':controller/:action', '{controller}/{action?index}', $map); |
|
18 | 4 | if (self::needToRun($map)) { |
|
19 | 1 | $map = self::transform($map); |
|
20 | } |
||
21 | |||
22 | 4 | return $map; |
|
23 | } |
||
24 | |||
25 | /** |
||
26 | * @param $string |
||
27 | * @return bool |
||
28 | */ |
||
29 | 4 | protected static function needToRun($string) |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param $string |
||
36 | * @return string|string[]|null |
||
37 | */ |
||
38 | 1 | protected static function transform($string) |
|
44 |