| Conditions | 7 | 
| Paths | 8 | 
| Total Lines | 21 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 28 | protected function initDefaultRoute($name, &$params = [])  | 
            ||
| 29 |     { | 
            ||
| 30 | $route = $this->hasRoute($name);  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 31 |         if ($route) { | 
            ||
| 32 | return $name;  | 
            ||
| 33 | }  | 
            ||
| 34 |         $parts = explode(".", $name); | 
            ||
| 35 | $count = count($parts);  | 
            ||
| 36 |         if ($count <= 3) { | 
            ||
| 37 |             if (in_array(reset($parts), app('mvc.modules')->getNames())) { | 
            ||
| 38 | $module = array_shift($parts);  | 
            ||
| 39 | $params['controller'] = isset($parts[0]) ? $parts[0] : null;  | 
            ||
| 40 | $params['action'] = isset($parts[1]) ? $parts[1] : null;  | 
            ||
| 41 | $defaultRoute = $module . '.default';  | 
            ||
| 42 |                 if ($this->hasRoute($defaultRoute)) { | 
            ||
| 43 | return $defaultRoute;  | 
            ||
| 44 | }  | 
            ||
| 45 | }  | 
            ||
| 46 | }  | 
            ||
| 47 | return $name;  | 
            ||
| 48 | }  | 
            ||
| 49 | }  | 
            ||
| 50 | 
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.