Complex classes like GeneratorService often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use GeneratorService, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 9 |     class GeneratorService extends Service{ | 
            ||
| 10 | /**  | 
            ||
| 11 | * @Inyectable  | 
            ||
| 12 | * @var \PSFS\base\config\Config Servicio de configuración  | 
            ||
| 13 | */  | 
            ||
| 14 | protected $config;  | 
            ||
| 15 | /**  | 
            ||
| 16 | * @Inyectable  | 
            ||
| 17 | * @var \PSFS\base\Security Servicio de autenticación  | 
            ||
| 18 | */  | 
            ||
| 19 | protected $security;  | 
            ||
| 20 | /**  | 
            ||
| 21 | * @Inyectable  | 
            ||
| 22 | * @var \PSFS\base\Template Servicio de gestión de plantillas  | 
            ||
| 23 | */  | 
            ||
| 24 | protected $tpl;  | 
            ||
| 25 | |||
| 26 | /**  | 
            ||
| 27 | * Método que revisa las traducciones directorio a directorio  | 
            ||
| 28 | * @param $path  | 
            ||
| 29 | * @param $locale  | 
            ||
| 30 | * @return array  | 
            ||
| 31 | */  | 
            ||
| 32 | public static function findTranslations($path, $locale)  | 
            ||
| 62 | |||
| 63 | /**  | 
            ||
| 64 | * Servicio que genera la estructura de un módulo o lo actualiza en caso de ser necesario  | 
            ||
| 65 | * @param string $module  | 
            ||
| 66 | * @param boolean $force  | 
            ||
| 67 | * @param string $type  | 
            ||
| 68 | * @param boolean $is_module  | 
            ||
| 69 | * @return mixed  | 
            ||
| 70 | */  | 
            ||
| 71 | public function createStructureModule($module, $force = false, $type = "", $isModule = false)  | 
            ||
| 83 | |||
| 84 | /**  | 
            ||
| 85 | * Service that creates the root paths for the modules  | 
            ||
| 86 | * @param string $module  | 
            ||
| 87 | * @param string $mod_path  | 
            ||
| 88 | * @param boolean $isModule  | 
            ||
| 89 | */  | 
            ||
| 90 | private function createModulePath($module, $mod_path, $isModule = false)  | 
            ||
| 99 | |||
| 100 | /**  | 
            ||
| 101 | * Servicio que genera la estructura base  | 
            ||
| 102 | * @param $module  | 
            ||
| 103 | * @param $mod_path  | 
            ||
| 104 | * @param boolean $isModule  | 
            ||
| 105 | */  | 
            ||
| 106 | private function createModulePathTree($module, $mod_path, $isModule = false)  | 
            ||
| 127 | |||
| 128 | /**  | 
            ||
| 129 | * Servicio que genera las plantillas básicas de ficheros del módulo  | 
            ||
| 130 | * @param string $module  | 
            ||
| 131 | * @param string $mod_path  | 
            ||
| 132 | * @param boolean $force  | 
            ||
| 133 | * @param string $controllerType  | 
            ||
| 134 | * @param boolean $isModule  | 
            ||
| 135 | */  | 
            ||
| 136 | private function createModuleBaseFiles($module, $mod_path, $force = false, $controllerType = '', $isModule = false)  | 
            ||
| 148 | |||
| 149 | /**  | 
            ||
| 150 | * Servicio que ejecuta Propel y genera el modelo de datos  | 
            ||
| 151 | * @param string $module  | 
            ||
| 152 | * @param string $path  | 
            ||
| 153 | * @param boolean $isModule  | 
            ||
| 154 | */  | 
            ||
| 155 | private function createModuleModels($module, $path, $isModule = false)  | 
            ||
| 172 | |||
| 173 | /**  | 
            ||
| 174 | * @param string $module  | 
            ||
| 175 | * @param string $mod_path  | 
            ||
| 176 | * @param boolean $force  | 
            ||
| 177 | * @param string $controllerType  | 
            ||
| 178 | * @return boolean  | 
            ||
| 179 | */  | 
            ||
| 180 | private function generateControllerTemplate($module, $mod_path, $force = false, $controllerType = "")  | 
            ||
| 194 | |||
| 195 | /**  | 
            ||
| 196 | * @param string $module  | 
            ||
| 197 | * @param string $mod_path  | 
            ||
| 198 | * @param boolean $force  | 
            ||
| 199 | * @param string $controllerType  | 
            ||
| 200 | * @return boolean  | 
            ||
| 201 | */  | 
            ||
| 202 | private function generateBaseApiTemplate($module, $mod_path, $force = false, $controllerType = "")  | 
            ||
| 219 | |||
| 220 | /**  | 
            ||
| 221 | * @param string $mod_path  | 
            ||
| 222 | * @param boolean $force  | 
            ||
| 223 | * @return boolean  | 
            ||
| 224 | */  | 
            ||
| 225 | private function generateConfigTemplate($mod_path, $force = false)  | 
            ||
| 231 | |||
| 232 | /**  | 
            ||
| 233 | * @param string $module  | 
            ||
| 234 | * @param string $mod_path  | 
            ||
| 235 | * @param boolean $force  | 
            ||
| 236 | * @return boolean  | 
            ||
| 237 | */  | 
            ||
| 238 | private function generatePublicTemplates($mod_path, $force = false)  | 
            ||
| 246 | |||
| 247 | /**  | 
            ||
| 248 | * @param string $module  | 
            ||
| 249 | * @param string $mod_path  | 
            ||
| 250 | * @param boolean $force  | 
            ||
| 251 | * @return boolean  | 
            ||
| 252 | */  | 
            ||
| 253 | private function generateServiceTemplate($module, $mod_path, $force = false)  | 
            ||
| 265 | |||
| 266 | /**  | 
            ||
| 267 | * @param string $module  | 
            ||
| 268 | * @param string $mod_path  | 
            ||
| 269 | * @param boolean $force  | 
            ||
| 270 | * @param boolean $isModule  | 
            ||
| 271 | * @return boolean  | 
            ||
| 272 | */  | 
            ||
| 273 | private function genereateAutoloaderTemplate($module, $mod_path, $force = false, $isModule = false)  | 
            ||
| 285 | |||
| 286 | /**  | 
            ||
| 287 | * @param string $module  | 
            ||
| 288 | * @param string $mod_path  | 
            ||
| 289 | * @param boolean $force  | 
            ||
| 290 | * @return boolean  | 
            ||
| 291 | */  | 
            ||
| 292 | private function generateSchemaTemplate($module, $mod_path, $force = false)  | 
            ||
| 304 | |||
| 305 | /**  | 
            ||
| 306 | * @param string $module  | 
            ||
| 307 | * @param string $mod_path  | 
            ||
| 308 | * @param boolean $force  | 
            ||
| 309 | * @return boolean  | 
            ||
| 310 | */  | 
            ||
| 311 | private function generatePropertiesTemplate($module, $mod_path, $force = false)  | 
            ||
| 325 | |||
| 326 | /**  | 
            ||
| 327 | * @param string $module  | 
            ||
| 328 | * @param string $mod_path  | 
            ||
| 329 | * @param boolean $force  | 
            ||
| 330 | * @return boolean  | 
            ||
| 331 | */  | 
            ||
| 332 | private function generateIndexTemplate($module, $mod_path, $force = false)  | 
            ||
| 341 | |||
| 342 | /**  | 
            ||
| 343 | * Método que graba el contenido de una plantilla en un fichero  | 
            ||
| 344 | * @param string $fileContent  | 
            ||
| 345 | * @param string $filename  | 
            ||
| 346 | * @param boolean $force  | 
            ||
| 347 | * @return boolean  | 
            ||
| 348 | */  | 
            ||
| 349 |         private function writeTemplateToFile($fileContent, $filename, $force = false) { | 
            ||
| 363 | |||
| 364 | /**  | 
            ||
| 365 | * Create ApiBase  | 
            ||
| 366 | * @param string $module  | 
            ||
| 367 | * @param string $mod_path  | 
            ||
| 368 | * @param string $api  | 
            ||
| 369 | *  | 
            ||
| 370 | * @return bool  | 
            ||
| 371 | */  | 
            ||
| 372 | private function createApiBaseFile($module, $mod_path, $api)  | 
            ||
| 381 | |||
| 382 | /**  | 
            ||
| 383 | * Create Api  | 
            ||
| 384 | * @param string $module  | 
            ||
| 385 | * @param string $mod_path  | 
            ||
| 386 | * @param bool $force  | 
            ||
| 387 | * @param string $api  | 
            ||
| 388 | *  | 
            ||
| 389 | * @return bool  | 
            ||
| 390 | */  | 
            ||
| 391 | private function createApi($module, $mod_path, $force, $api)  | 
            ||
| 400 | |||
| 401 | /**  | 
            ||
| 402 | * Method that copy resources recursively  | 
            ||
| 403 | * @param string $dest  | 
            ||
| 404 | * @param boolean $force  | 
            ||
| 405 | * @param $filename_path  | 
            ||
| 406 | * @param boolean $debug  | 
            ||
| 407 | */  | 
            ||
| 408 | public static function copyResources($dest, $force, $filename_path, $debug)  | 
            ||
| 423 | |||
| 424 | /**  | 
            ||
| 425 | * Method that copy a resource  | 
            ||
| 426 | * @param string $src  | 
            ||
| 427 | * @param string $dst  | 
            ||
| 428 | * @throws ConfigException  | 
            ||
| 429 | */  | 
            ||
| 430 |         public static function copyr($src, $dst) { | 
            ||
| 444 | }  | 
            ||
| 445 | 
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.