| Conditions | 4 | 
| Paths | 6 | 
| Total Lines | 33 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php namespace Wn\Generators\Commands;  | 
            ||
| 17 | public function handle()  | 
            ||
| 18 |     { | 
            ||
| 19 |     	$model = $this->argument('model'); | 
            ||
| 20 | $name = '';  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 21 |     	if(strrpos($model, "\\") === false){ | 
            ||
| 22 | $name = $model;  | 
            ||
| 23 | $model = "App\\Models\\" . $model;  | 
            ||
| 24 |     	} else { | 
            ||
| 25 |     		$name = explode("\\", $model); | 
            ||
| 26 | $name = $name[count($name) - 1];  | 
            ||
| 27 | }  | 
            ||
| 28 | $controller = ucwords(\Illuminate\Support\Str::plural($name)) . 'Controller';  | 
            ||
| 29 |         $content = $this->getTemplate('controller') | 
            ||
| 30 | ->with([  | 
            ||
| 31 | 'name' => $controller,  | 
            ||
| 32 | 'model' => $model  | 
            ||
| 33 | ])  | 
            ||
| 34 | ->get();  | 
            ||
| 35 | |||
| 36 |         $this->save($content, "./app/Http/Controllers/{$controller}.php", "{$controller}"); | 
            ||
| 37 |         if(! $this->option('no-routes')){ | 
            ||
| 38 | $options = [  | 
            ||
| 39 | 'resource' => \Illuminate\Support\Str::snake($name, '-'),  | 
            ||
| 40 | '--controller' => $controller,  | 
            ||
| 41 | ];  | 
            ||
| 42 | |||
| 43 |             if ($this->option('laravel')) { | 
            ||
| 44 | $options['--laravel'] = true;  | 
            ||
| 45 | }  | 
            ||
| 46 | |||
| 47 |             $this->call('wn:route', $options); | 
            ||
| 48 | }  | 
            ||
| 49 | }  | 
            ||
| 50 | |||
| 52 | 
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.