Passed
Push — master ( 29c6ce...4ea3b3 )
by Fran
04:58
created
src/base/types/helpers/GeneratorHelper.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
             $objects = scandir($dir);
24 24
             foreach ($objects as $object) {
25 25
                 if ($object != "." && $object != "..") {
26
-                    if (filetype($dir . "/" . $object) == "dir") {
27
-                        self::deleteDir($dir . "/" . $object);
28
-                    } else {
29
-                        unlink($dir . "/" . $object);
26
+                    if (filetype($dir."/".$object) == "dir") {
27
+                        self::deleteDir($dir."/".$object);
28
+                    }else {
29
+                        unlink($dir."/".$object);
30 30
                     }
31 31
                 }
32 32
             }
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $rootDirs = array("css", "js", "media", "font");
44 44
         foreach ($rootDirs as $dir) {
45
-            if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) {
45
+            if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) {
46 46
                 try {
47
-                    self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir);
48
-                } catch (\Exception $e) {
47
+                    self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir);
48
+                }catch (\Exception $e) {
49 49
                     Logger::log($e->getMessage());
50 50
                 }
51 51
             }
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
     {
62 62
         try {
63 63
             if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) {
64
-                throw new \Exception(t('Can\'t create directory ') . $dir);
64
+                throw new \Exception(t('Can\'t create directory ').$dir);
65 65
             }
66
-        } catch (\Exception $e) {
66
+        }catch (\Exception $e) {
67 67
             Logger::log($e->getMessage(), LOG_WARNING);
68 68
             if (!file_exists(dirname($dir))) {
69
-                throw new GeneratorException($e->getMessage() . $dir);
69
+                throw new GeneratorException($e->getMessage().$dir);
70 70
             }
71 71
         }
72 72
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public static function getTemplatePath()
79 79
     {
80
-        $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
80
+        $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR;
81 81
         return realpath($path);
82 82
     }
83 83
 
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
      * @throws \ReflectionException
97 97
      */
98 98
     public static function checkCustomNamespaceApi($namespace) {
99
-        if(!empty($namespace)) {
100
-            if(class_exists($namespace)) {
99
+        if (!empty($namespace)) {
100
+            if (class_exists($namespace)) {
101 101
                 $reflector = new \ReflectionClass($namespace);
102
-                if(!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) {
102
+                if (!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) {
103 103
                     throw new GeneratorException(t('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501);
104
-                } elseif(!$reflector->isAbstract()) {
104
+                } elseif (!$reflector->isAbstract()) {
105 105
                     throw new GeneratorException(t('La clase definida debe ser abstracta'), 501);
106 106
                 }
107
-            } else {
107
+            }else {
108 108
                 throw new GeneratorException(t('La clase definida para extender la API no existe'), 501);
109 109
             }
110 110
         }
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
      * @return array
116 116
      */
117 117
     public static function getDomainPaths($domain) {
118
-        $domains = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json'), true);
118
+        $domains = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json'), true);
119 119
         $paths = [];
120
-        if(null !== $domains) {
120
+        if (null !== $domains) {
121 121
             $keyDomains = array_keys($domains);
122
-            foreach($keyDomains as $keyDomain) {
122
+            foreach ($keyDomains as $keyDomain) {
123 123
                 $key = strtoupper(str_replace(['@', '/'], '', $keyDomain));
124
-                if(strtoupper($domain) === $key) {
124
+                if (strtoupper($domain) === $key) {
125 125
                     $paths = $domains[$keyDomain];
126 126
                     break;
127 127
                 }
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public static function createRoot($path = WEB_DIR, OutputInterface $output = null) {
139 139
 
140
-        if(null === $output) {
140
+        if (null === $output) {
141 141
             $output = new ConsoleOutput();
142 142
         }
143 143
 
144 144
         GeneratorHelper::createDir($path);
145 145
         $paths = array("js", "css", "img", "media", "font");
146 146
         foreach ($paths as $htmlPath) {
147
-            GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath);
147
+            GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath);
148 148
         }
149 149
 
150 150
         // Generates the root needed files
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
         ];
158 158
         $output->writeln('Start creating html files');
159 159
         foreach ($files as $templates => $filename) {
160
-            $text = Template::getInstance()->dump("generator/html/" . $templates . '.html.twig');
161
-            if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) {
162
-                $output->writeln('Can\t create the file ' . $filename);
163
-            } else {
164
-                $output->writeln($filename . ' created successfully');
160
+            $text = Template::getInstance()->dump("generator/html/".$templates.'.html.twig');
161
+            if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) {
162
+                $output->writeln('Can\t create the file '.$filename);
163
+            }else {
164
+                $output->writeln($filename.' created successfully');
165 165
             }
166 166
         }
167 167
 
168 168
         //Export base locale translations
169
-        if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) {
170
-            GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
171
-            GeneratorService::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
169
+        if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) {
170
+            GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
171
+            GeneratorService::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale');
172 172
         }
173 173
     }
174 174
 }
175 175
\ No newline at end of file
Please login to merge, or discard this patch.
src/base/types/helpers/DeployHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     public static function updateCacheVar() {
18 18
         $now = new \DateTime(null, new \DateTimeZone(Config::getParam('project.timezone', 'Europe/Madrid')));
19 19
         $config = Config::getInstance()->dumpConfig();
20
-        $config[self::CACHE_VAR_TAG] = 'v' . $now->format('Ymd.His');
20
+        $config[self::CACHE_VAR_TAG] = 'v'.$now->format('Ymd.His');
21 21
         Config::save($config);
22 22
         return $config[self::CACHE_VAR_TAG];
23 23
     }
Please login to merge, or discard this patch.
src/controller/GeneratorController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function generateModule()
30 30
     {
31
-        Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri());
31
+        Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri());
32 32
         /* @var $form \PSFS\base\config\ConfigForm */
33 33
         $form = new ModuleForm();
34 34
         $form->build();
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
                 $this->gen->createStructureModule($module, false, $type, $apiClass);
61 61
                 Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, t("Módulo %s generado correctamente")));
62 62
                 // Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true));
63
-            } catch (\Exception $e) {
64
-                Logger::log($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]");
63
+            }catch (\Exception $e) {
64
+                Logger::log($e->getMessage()." [".$e->getFile().":".$e->getLine()."]");
65 65
                 Security::getInstance()->setFlash("callback_message", htmlentities($e->getMessage()));
66 66
             }
67 67
         }
Please login to merge, or discard this patch.