Conditions | 6 |
Paths | 10 |
Total Lines | 19 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
42 | protected function initMvcRoute($name, &$params = []) |
||
43 | { |
||
44 | $parts = explode(".", $name); |
||
45 | $count = count($parts); |
||
46 | if ($count > 3) { |
||
47 | return $name; |
||
48 | } |
||
49 | $firstPart = strtolower(reset($parts)); |
||
50 | if (!in_array($firstPart, app('mvc.modules')->getNames())) { |
||
51 | return $name; |
||
52 | } |
||
53 | $module = array_shift($parts); |
||
54 | $params['controller'] = isset($parts[0]) ? $parts[0] : null; |
||
55 | $params['action'] = isset($parts[1]) ? $parts[1] : null; |
||
56 | $defaultRoute = $module . '.default'; |
||
57 | if ($this->hasRoute($defaultRoute)) { |
||
58 | return $defaultRoute; |
||
59 | } |
||
60 | return $name; |
||
61 | } |
||
63 |