Test Failed
Push — master ( 8aa2ec...ce2bc1 )
by Fran
18:34
created
src/base/types/helpers/GeneratorHelper.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
             $objects = scandir($dir);
27 27
             foreach ($objects as $object) {
28 28
                 if ($object != "." && $object != "..") {
29
-                    if (filetype($dir . "/" . $object) == "dir") {
30
-                        self::deleteDir($dir . "/" . $object);
31
-                    } else {
32
-                        unlink($dir . "/" . $object);
29
+                    if (filetype($dir."/".$object) == "dir") {
30
+                        self::deleteDir($dir."/".$object);
31
+                    }else {
32
+                        unlink($dir."/".$object);
33 33
                     }
34 34
                 }
35 35
             }
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $rootDirs = array("css", "js", "media", "font");
46 46
         foreach ($rootDirs as $dir) {
47
-            if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) {
47
+            if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) {
48 48
                 try {
49
-                    self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir);
50
-                } catch (\Exception $e) {
49
+                    self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir);
50
+                }catch (\Exception $e) {
51 51
                     syslog(LOG_INFO, $e->getMessage());
52 52
                 }
53 53
             }
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
         if (!empty($dir)) {
65 65
             try {
66 66
                 if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) {
67
-                    throw new Exception(t('Can\'t create directory ') . $dir);
67
+                    throw new Exception(t('Can\'t create directory ').$dir);
68 68
                 }
69
-            } catch (\Exception $e) {
69
+            }catch (\Exception $e) {
70 70
                 syslog(LOG_WARNING, $e->getMessage());
71 71
                 if (!file_exists(dirname($dir))) {
72
-                    throw new GeneratorException($e->getMessage() . $dir);
72
+                    throw new GeneratorException($e->getMessage().$dir);
73 73
                 }
74 74
             }
75 75
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public static function getTemplatePath(): string
83 83
     {
84
-        $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
84
+        $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR;
85 85
         return realpath($path);
86 86
     }
87 87
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                 } elseif (!$reflector->isAbstract()) {
110 110
                     throw new GeneratorException(t('La clase definida debe ser abstracta'), 501);
111 111
                 }
112
-            } else {
112
+            }else {
113 113
                 throw new GeneratorException(t('La clase definida para extender la API no existe'), 501);
114 114
             }
115 115
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         GeneratorHelper::createDir($path);
132 132
         $paths = array("js", "css", "img", "media", "font");
133 133
         foreach ($paths as $htmlPath) {
134
-            GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath);
134
+            GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath);
135 135
         }
136 136
 
137 137
         // Generates the root needed files
@@ -141,35 +141,35 @@  discard block
 block discarded – undo
141 141
             'crossdomain' => 'crossdomain.xml',
142 142
             'humans' => 'humans.txt',
143 143
             'robots' => 'robots.txt',
144
-            'docker' => '..' . DIRECTORY_SEPARATOR . 'docker-compose.yml',
144
+            'docker' => '..'.DIRECTORY_SEPARATOR.'docker-compose.yml',
145 145
         ];
146 146
         $verificable = ['humans', 'robots', 'docker'];
147 147
         if (!$quiet) {
148 148
             $output->writeln('Start creating html files');
149 149
         }
150 150
         foreach ($files as $template => $filename) {
151
-            if (in_array($template, $verificable) && file_exists($path . DIRECTORY_SEPARATOR . $filename)) {
151
+            if (in_array($template, $verificable) && file_exists($path.DIRECTORY_SEPARATOR.$filename)) {
152 152
                 if (!$quiet) {
153
-                    $output->writeln($filename . ' already exists');
153
+                    $output->writeln($filename.' already exists');
154 154
                 }
155 155
                 continue;
156 156
             }
157
-            $text = Template::getInstance()->dump("generator/html/" . $template . '.html.twig');
158
-            if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) {
157
+            $text = Template::getInstance()->dump("generator/html/".$template.'.html.twig');
158
+            if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) {
159 159
                 if (!$quiet) {
160
-                    $output->writeln('Can\t create the file ' . $filename);
160
+                    $output->writeln('Can\t create the file '.$filename);
161 161
                 }
162
-            } else {
162
+            }else {
163 163
                 if (!$quiet) {
164
-                    $output->writeln($filename . ' created successfully');
164
+                    $output->writeln($filename.' created successfully');
165 165
                 }
166 166
             }
167 167
         }
168 168
 
169 169
         //Export base locale translations
170
-        if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) {
171
-            GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
172
-            self::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
170
+        if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) {
171
+            GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
172
+            self::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale');
173 173
         }
174 174
     }
175 175
 
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
     {
186 186
         if (file_exists($filenamePath)) {
187 187
             $destfolder = basename($filenamePath);
188
-            if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) {
188
+            if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) {
189 189
                 if (is_dir($filenamePath)) {
190
-                    self::copyr($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
191
-                } else {
192
-                    if (@copy($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) {
193
-                        throw new ConfigException("Can't copy " . $filenamePath . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
190
+                    self::copyr($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
191
+                }else {
192
+                    if (@copy($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) {
193
+                        throw new ConfigException("Can't copy ".$filenamePath." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
194 194
                     }
195 195
                 }
196 196
             }
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
         self::createDir($dst);
210 210
         while (false !== ($file = readdir($dir))) {
211 211
             if (($file != '.') && ($file != '..')) {
212
-                if (is_dir($src . '/' . $file)) {
213
-                    self::copyr($src . '/' . $file, $dst . '/' . $file);
214
-                } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) {
215
-                    throw new ConfigException("Can't copy " . $src . " to " . $dst);
212
+                if (is_dir($src.'/'.$file)) {
213
+                    self::copyr($src.'/'.$file, $dst.'/'.$file);
214
+                } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) {
215
+                    throw new ConfigException("Can't copy ".$src." to ".$dst);
216 216
                 }
217 217
             }
218 218
         }
Please login to merge, or discard this patch.