@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function generateModule() |
| 32 | 32 | { |
| 33 | - Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri()); |
|
| 33 | + Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri()); |
|
| 34 | 34 | /* @var $form \PSFS\base\config\ConfigForm */ |
| 35 | 35 | $form = new ModuleForm(); |
| 36 | 36 | $form->build(); |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | $this->gen->createStructureModule($module, false, $type, $apiClass); |
| 62 | 62 | Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente"))); |
| 63 | 63 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
| 64 | - } catch (\Exception $e) { |
|
| 65 | - Logger::getInstance()->infoLog($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]"); |
|
| 64 | + }catch (\Exception $e) { |
|
| 65 | + Logger::getInstance()->infoLog($e->getMessage()." [".$e->getFile().":".$e->getLine()."]"); |
|
| 66 | 66 | Security::getInstance()->setFlash("callback_message", $e->getMessage()); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | $objects = scandir($dir); |
| 20 | 20 | foreach ($objects as $object) { |
| 21 | 21 | if ($object != "." && $object != "..") { |
| 22 | - if (filetype($dir . "/" . $object) == "dir") { |
|
| 23 | - self::deleteDir($dir . "/" . $object); |
|
| 24 | - } else { |
|
| 25 | - unlink($dir . "/" . $object); |
|
| 22 | + if (filetype($dir."/".$object) == "dir") { |
|
| 23 | + self::deleteDir($dir."/".$object); |
|
| 24 | + }else { |
|
| 25 | + unlink($dir."/".$object); |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $rootDirs = array("css", "js", "media", "font"); |
| 40 | 40 | foreach ($rootDirs as $dir) { |
| 41 | - if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) { |
|
| 41 | + if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) { |
|
| 42 | 42 | try { |
| 43 | - self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir); |
|
| 44 | - } catch (\Exception $e) { |
|
| 43 | + self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir); |
|
| 44 | + }catch (\Exception $e) { |
|
| 45 | 45 | Logger::log($e->getMessage()); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | try { |
| 59 | 59 | if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) { |
| 60 | - throw new \Exception(_('Can\'t create directory ') . $dir); |
|
| 60 | + throw new \Exception(_('Can\'t create directory ').$dir); |
|
| 61 | 61 | } |
| 62 | - } catch (\Exception $e) { |
|
| 62 | + }catch (\Exception $e) { |
|
| 63 | 63 | Logger::log($e->getMessage(), LOG_WARNING); |
| 64 | 64 | if (!file_exists(dirname($dir))) { |
| 65 | - throw new GeneratorException($e->getMessage() . $dir); |
|
| 65 | + throw new GeneratorException($e->getMessage().$dir); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public static function getTemplatePath() |
| 75 | 75 | { |
| 76 | - $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR; |
|
| 76 | + $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR; |
|
| 77 | 77 | return realpath($path); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | * @throws GeneratorException |
| 92 | 92 | */ |
| 93 | 93 | public static function checkCustomNamespaceApi($namespace) { |
| 94 | - if(!empty($namespace)) { |
|
| 95 | - if(class_exists($namespace)) { |
|
| 94 | + if (!empty($namespace)) { |
|
| 95 | + if (class_exists($namespace)) { |
|
| 96 | 96 | $reflector = new \ReflectionClass($namespace); |
| 97 | - if(!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) { |
|
| 97 | + if (!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) { |
|
| 98 | 98 | throw new GeneratorException(_('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501); |
| 99 | - } elseif(!$reflector->isAbstract()) { |
|
| 99 | + } elseif (!$reflector->isAbstract()) { |
|
| 100 | 100 | throw new GeneratorException(_('La clase definida debe ser abstracta'), 501); |
| 101 | 101 | } |
| 102 | - } else { |
|
| 102 | + }else { |
|
| 103 | 103 | throw new GeneratorException(_('La clase definida para extender la API no existe'), 501); |
| 104 | 104 | } |
| 105 | 105 | } |