| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 51 | 
| Code Lines | 33 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 11 | public function generate()  | 
            ||
| 12 |     {
 | 
            ||
| 13 | $generatedFiles = [];  | 
            ||
| 14 | |||
| 15 |         $routeProviderFile = $this->getPath("app/Providers/")."LaragenRouteServiceProvider.php";
 | 
            ||
| 16 |         $webAuthRouteFile = $this->getPath("routes/backend/")."auth.php";
 | 
            ||
| 17 |         $webRouteFile = $this->getPath("routes/frontend/")."web.php";
 | 
            ||
| 18 |         $backendWebRouteFile = $this->getPath("routes/backend/")."web.php";
 | 
            ||
| 19 | |||
| 20 | $this->initializeFiles([  | 
            ||
| 21 | $routeProviderFile => "RouteServiceProvider",  | 
            ||
| 22 | $webAuthRouteFile => "Routes/Backend-auth",  | 
            ||
| 23 | $webRouteFile => "Route",  | 
            ||
| 24 | $backendWebRouteFile => "Routes/Backend-web"  | 
            ||
| 25 | ]);  | 
            ||
| 26 | |||
| 27 | $this->insertIntoFile(  | 
            ||
| 28 | $routeProviderFile,  | 
            ||
| 29 |             $this->getStub('fragments/RouteMap'),
 | 
            ||
| 30 |             "\n".$this->getStub('fragments/RouteMapCode')
 | 
            ||
| 31 | );  | 
            ||
| 32 | |||
| 33 | $this->insertIntoFile(  | 
            ||
| 34 | $webRouteFile,  | 
            ||
| 35 | "<?php\n",  | 
            ||
| 36 | "use App\\Http\\Controllers\\".$this->module->getModelName()."Controller;\n"  | 
            ||
| 37 | );  | 
            ||
| 38 | |||
| 39 | $this->insertIntoFile(  | 
            ||
| 40 | $webRouteFile,  | 
            ||
| 41 | "/" . "* Insert your routes here */",  | 
            ||
| 42 |             "\n".$this->getTabs(1)."Route::resource('".$this->module->getModuleName()."', ".$this->module->getModelName()."Controller::class);"
 | 
            ||
| 43 | );  | 
            ||
| 44 | |||
| 45 | $generatedFiles[] = $webRouteFile;  | 
            ||
| 46 | |||
| 47 | $this->insertIntoFile(  | 
            ||
| 48 | $backendWebRouteFile,  | 
            ||
| 49 | "<?php\n",  | 
            ||
| 50 | "use App\\Http\\Controllers\\".$this->module->getModelName()."Controller;\n"  | 
            ||
| 51 | );  | 
            ||
| 52 | |||
| 53 | $this->insertIntoFile(  | 
            ||
| 54 | $backendWebRouteFile,  | 
            ||
| 55 | "/" . "* Insert your routes here */",  | 
            ||
| 56 |             "\n".$this->getTabs(1)."Route::resource('".$this->module->getModuleName()."', ".$this->module->getModelName()."Controller::class);"
 | 
            ||
| 57 | );  | 
            ||
| 58 | |||
| 59 | $generatedFiles[] = $backendWebRouteFile;  | 
            ||
| 60 | |||
| 61 | return $generatedFiles;  | 
            ||
| 62 | }  | 
            ||
| 64 |