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