Passed
Push — master ( 70f98a...9ce8e2 )
by Fran
05:26
created
src/controller/I18nController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
         //Generating the templates translations
39 39
         $translations = $this->tpl->regenerateTemplates();
40 40
 
41
-        $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
42
-        $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR;
41
+        $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
42
+        $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR;
43 43
 
44 44
         //xgettext localizations
45 45
         $translations = array_merge($translations, GeneratorService::findTranslations(SOURCE_DIR, $locale));
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@
 block discarded – undo
33 33
     public function getTranslations($locale)
34 34
     {
35 35
         //Default locale
36
-        if (null === $locale) $locale = $this->config->get("default_language");
36
+        if (null === $locale) {
37
+            $locale = $this->config->get("default_language");
38
+        }
37 39
 
38 40
         //Generating the templates translations
39 41
         $translations = $this->tpl->regenerateTemplates();
Please login to merge, or discard this patch.
src/controller/UserController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                 Logger::log('Configuration saved successful');
54 54
                 Security::getInstance()->setFlash("callback_message", _("Usuario agregado correctamente"));
55 55
                 Security::getInstance()->setFlash("callback_route", $this->getRoute("admin"), true);
56
-            } else {
56
+            }else {
57 57
                 throw new ConfigException(_('Error al guardar los administradores, prueba a cambiar los permisos'));
58 58
             }
59 59
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 $cookies = array(
105 105
                     array(
106 106
                         "name" => Security::getInstance()->getHash(),
107
-                        "value" => base64_encode($form->getFieldValue("user") . ":" . $form->getFieldValue("pass")),
107
+                        "value" => base64_encode($form->getFieldValue("user").":".$form->getFieldValue("pass")),
108 108
                         "expire" => time() + 3600,
109 109
                         "http" => true,
110 110
                     )
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                     'status_message' => _("Acceso permitido... redirigiendo!!"),
116 116
                     'delay' => 1,
117 117
                 );
118
-            } else {
118
+            }else {
119 119
                 $form->setError("user", _("El usuario no tiene acceso a la web"));
120 120
             }
121 121
         }
Please login to merge, or discard this patch.
src/controller/ConfigController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
     public function getConfigParams() {
26 26
         $response = array_merge(Config::$required, Config::$optional);
27 27
         $domains = Router::getInstance()->getDomains();
28
-        foreach($domains as $domain => $routes) {
28
+        foreach ($domains as $domain => $routes) {
29 29
             $pDomain = str_replace('@', '', $domain);
30 30
             $pDomain = str_replace('/', '', $pDomain);
31
-            $response[] = strtolower($pDomain) . '.api.secret';
31
+            $response[] = strtolower($pDomain).'.api.secret';
32 32
         }
33 33
         return $this->json($response);
34 34
     }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function config()
44 44
     {
45
-        Logger::log("Config loaded executed by " . $this->getRequest()->getRequestUri());
45
+        Logger::log("Config loaded executed by ".$this->getRequest()->getRequestUri());
46 46
         /* @var $form \PSFS\base\config\ConfigForm */
47 47
         $form = new ConfigForm();
48 48
         $form->build();
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 }
80 80
                 Security::getInstance()->setFlash("callback_message", _("Configuración actualizada correctamente"));
81 81
                 Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-config", true));
82
-            } else {
82
+            }else {
83 83
                 throw new \HttpException(_('Error al guardar la configuración, prueba a cambiar los permisos'), 403);
84 84
             }
85 85
         }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      * @GET
29 29
      * @route /admin/routes/show
30 30
      * @visible false
31
-     * @return mixed
31
+     * @return string|null
32 32
      */
33 33
     public function getRouting()
34 34
     {
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
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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,9 +61,9 @@  discard block
 block discarded – undo
61 61
                 $this->gen->createStructureModule($module, $force, $type, (bool)$is_module);
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) {
64
+            }catch (\Exception $e) {
65 65
                 pre($e->getMessage(), true);
66
-                Logger::getInstance()->infoLog($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]");
66
+                Logger::getInstance()->infoLog($e->getMessage()." [".$e->getFile().":".$e->getLine()."]");
67 67
                 throw new ConfigException('Error al generar el módulo, prueba a cambiar los permisos', 403);
68 68
             }
69 69
         }
Please login to merge, or discard this patch.
src/services/GeneratorService.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     /**
28 28
      * Método que revisa las traducciones directorio a directorio
29
-     * @param $path
29
+     * @param string $path
30 30
      * @param $locale
31 31
      * @return array
32 32
      */
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 
100 100
     /**
101 101
      * Servicio que genera la estructura base
102
-     * @param $module
103
-     * @param $mod_path
102
+     * @param string $module
103
+     * @param string $mod_path
104 104
      * @param boolean $isModule
105 105
      */
106 106
     private function createModulePathTree($module, $mod_path, $isModule = false)
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
      * Method that copy resources recursively
454 454
      * @param string $dest
455 455
      * @param boolean $force
456
-     * @param $filename_path
456
+     * @param string $filename_path
457 457
      * @param boolean $debug
458 458
      */
459 459
     public static function copyResources($dest, $force, $filename_path, $debug)
Please login to merge, or discard this patch.
Spacing   +61 added lines, -62 removed lines patch added patch discarded remove patch
@@ -32,24 +32,24 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function findTranslations($path, $locale)
34 34
     {
35
-        $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
36
-        $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR;
35
+        $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
36
+        $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR;
37 37
 
38 38
         $translations = array();
39 39
         if (file_exists($path)) {
40 40
             $d = dir($path);
41 41
             while (false !== ($dir = $d->read())) {
42 42
                 Config::createDir($locale_path);
43
-                if (!file_exists($locale_path . 'translations.po')) {
44
-                    file_put_contents($locale_path . 'translations.po', '');
43
+                if (!file_exists($locale_path.'translations.po')) {
44
+                    file_put_contents($locale_path.'translations.po', '');
45 45
                 }
46
-                $inspect_path = realpath($path . DIRECTORY_SEPARATOR . $dir);
47
-                $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext " .
48
-                    $inspect_path . DIRECTORY_SEPARATOR .
46
+                $inspect_path = realpath($path.DIRECTORY_SEPARATOR.$dir);
47
+                $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ".
48
+                    $inspect_path.DIRECTORY_SEPARATOR.
49 49
                     "*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po";
50
-                if (is_dir($path . DIRECTORY_SEPARATOR . $dir) && preg_match('/^\./', $dir) == 0) {
51
-                    $res = _('Revisando directorio: ') . $inspect_path;
52
-                    $res .= _('Comando ejecutado: ') . $cmd_php;
50
+                if (is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./', $dir) == 0) {
51
+                    $res = _('Revisando directorio: ').$inspect_path;
52
+                    $res .= _('Comando ejecutado: ').$cmd_php;
53 53
                     $res .= shell_exec($cmd_php);
54 54
                     usleep(10);
55 55
                     $translations[] = $res;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function createStructureModule($module, $force = false, $type = "", $isModule = false)
72 72
     {
73
-        $mod_path = CORE_DIR . DIRECTORY_SEPARATOR;
73
+        $mod_path = CORE_DIR.DIRECTORY_SEPARATOR;
74 74
         $module = ucfirst($module);
75 75
         $this->createModulePath($module, $mod_path, $isModule);
76 76
         $this->createModulePathTree($module, $mod_path, $isModule);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         Config::createDir($mod_path);
94 94
         // Create module path
95 95
         if (false === $isModule) {
96
-            Config::createDir($mod_path . $module);
96
+            Config::createDir($mod_path.$module);
97 97
         }
98 98
     }
99 99
 
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
         $paths = [
111 111
             "Api", "Api/base", "Config", "Controller", "Form", "Models", "Public", "Templates", "Services", "Test"
112 112
         ];
113
-        $module_path = $isModule ? $mod_path : $mod_path . $module;
113
+        $module_path = $isModule ? $mod_path : $mod_path.$module;
114 114
         foreach ($paths as $path) {
115
-            Config::createDir($module_path . DIRECTORY_SEPARATOR . $path);
115
+            Config::createDir($module_path.DIRECTORY_SEPARATOR.$path);
116 116
         }
117 117
         //Creamos las carpetas de los assets
118 118
         $htmlPaths = array("css", "js", "img", "media", "font");
119 119
         foreach ($htmlPaths as $path) {
120
-            Config::createDir($module_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path);
120
+            Config::createDir($module_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path);
121 121
         }
122 122
 
123 123
         if ($isModule) {
124 124
             return $this->writeTemplateToFile(json_encode([
125
-                "module" => "\\" . preg_replace('/(\\\|\/)/', '\\\\', $module),
126
-            ], JSON_PRETTY_PRINT), $mod_path . DIRECTORY_SEPARATOR . "module.json", true);
125
+                "module" => "\\".preg_replace('/(\\\|\/)/', '\\\\', $module),
126
+            ], JSON_PRETTY_PRINT), $mod_path.DIRECTORY_SEPARATOR."module.json", true);
127 127
         }
128 128
     }
129 129
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     private function createModuleBaseFiles($module, $mod_path, $force = false, $controllerType = '', $isModule = false)
139 139
     {
140
-        $module_path = $isModule ? $mod_path : $mod_path . $module;
140
+        $module_path = $isModule ? $mod_path : $mod_path.$module;
141 141
         $this->generateControllerTemplate($module, $module_path, $force, $controllerType);
142 142
         $this->generateServiceTemplate($module, $module_path, $force);
143 143
         $this->genereateAutoloaderTemplate($module, $module_path, $force, $isModule);
@@ -156,24 +156,24 @@  discard block
 block discarded – undo
156 156
      */
157 157
     private function createModuleModels($module, $path, $isModule = false)
158 158
     {
159
-        $module_path = $isModule ? $path : $path . $module;
160
-        $module_path = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $module_path);
159
+        $module_path = $isModule ? $path : $path.$module;
160
+        $module_path = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $module_path);
161 161
         //Generamos las clases de propel y la configuración
162
-        $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR .
163
-            "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel ";
164
-        $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path .
165
-            DIRECTORY_SEPARATOR . "Config";
166
-        $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR .
167
-            "Config --output-dir=" . CORE_DIR . " --verbose";
168
-        $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n" . $exec . "build" . $opt . $schemaOpt);
169
-        $ret = shell_exec($exec . "build" . $opt . $schemaOpt);
162
+        $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR.
163
+            "vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel ";
164
+        $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.
165
+            DIRECTORY_SEPARATOR."Config";
166
+        $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR.
167
+            "Config --output-dir=".CORE_DIR." --verbose";
168
+        $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n".$exec."build".$opt.$schemaOpt);
169
+        $ret = shell_exec($exec."build".$opt.$schemaOpt);
170 170
 
171 171
         $this->log->infoLog("[GENERATOR] Generamos clases invocando a propel:\n $ret");
172
-        $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR .
173
-            $module_path . DIRECTORY_SEPARATOR . "Config" . $schemaOpt);
172
+        $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.
173
+            $module_path.DIRECTORY_SEPARATOR."Config".$schemaOpt);
174 174
         $this->log->infoLog("[GENERATOR] Generamos sql invocando a propel:\n $ret");
175
-        $ret = shell_exec($exec . "config:convert" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR .
176
-            $module_path . DIRECTORY_SEPARATOR . "Config");
175
+        $ret = shell_exec($exec."config:convert".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.
176
+            $module_path.DIRECTORY_SEPARATOR."Config");
177 177
         $this->log->infoLog("[GENERATOR] Generamos configuración invocando a propel:\n $ret");
178 178
     }
179 179
 
@@ -194,23 +194,23 @@  discard block
 block discarded – undo
194 194
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
195 195
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
196 196
             "class" => $class,
197
-            "controllerType" => $class . "Base",
197
+            "controllerType" => $class."Base",
198 198
             "is_base" => false
199 199
         ));
200
-        $controller = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" .
201
-            DIRECTORY_SEPARATOR . "{$class}Controller.php", $force);
200
+        $controller = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller".
201
+            DIRECTORY_SEPARATOR."{$class}Controller.php", $force);
202 202
 
203 203
         $controllerBody = $this->tpl->dump("generator/controller.template.twig", array(
204 204
             "module" => $module,
205 205
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
206 206
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
207
-            "class" => $class . "Base",
207
+            "class" => $class."Base",
208 208
             "service" => $class,
209 209
             "controllerType" => $controllerType,
210 210
             "is_base" => true
211 211
         ));
212
-        $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" .
213
-            DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true);
212
+        $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller".
213
+            DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true);
214 214
         return ($controller && $controllerBase);
215 215
     }
216 216
 
@@ -225,8 +225,7 @@  discard block
 block discarded – undo
225 225
     {
226 226
         $created = true;
227 227
         $modelPath = $isModule ?
228
-            $mod_path . DIRECTORY_SEPARATOR . 'Models' :
229
-            $mod_path . $module . DIRECTORY_SEPARATOR . 'Models';
228
+            $mod_path.DIRECTORY_SEPARATOR.'Models' : $mod_path.$module.DIRECTORY_SEPARATOR.'Models';
230 229
         if (file_exists($modelPath)) {
231 230
             $dir = dir($modelPath);
232 231
             while ($file = $dir->read()) {
@@ -254,7 +253,7 @@  discard block
 block discarded – undo
254 253
         //Generamos el fichero de configuración
255 254
         $this->log->infoLog("Generamos fichero vacío de configuración");
256 255
         return $this->writeTemplateToFile("<?php\n\t",
257
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php",
256
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php",
258 257
             $force);
259 258
     }
260 259
 
@@ -269,10 +268,10 @@  discard block
 block discarded – undo
269 268
         //Generamos el fichero de configuración
270 269
         $this->log->infoLog("Generamos ficheros para assets base");
271 270
         $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n",
272
-            $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css",
271
+            $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css",
273 272
             $force);
274 273
         $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();",
275
-            $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js",
274
+            $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js",
276 275
             $force);
277 276
         return ($css && $js);
278 277
     }
@@ -294,7 +293,7 @@  discard block
 block discarded – undo
294 293
             "class" => $class,
295 294
         ));
296 295
         return $this->writeTemplateToFile($controller,
297
-            $mod_path . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$class}Service.php",
296
+            $mod_path.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$class}Service.php",
298 297
             $force);
299 298
     }
300 299
 
@@ -315,7 +314,7 @@  discard block
 block discarded – undo
315 314
             "regex" => preg_replace('/(\\\|\/)/m', '\\\\\\\\\\\\', $module),
316 315
             "is_module" => $isModule,
317 316
         ));
318
-        return $this->writeTemplateToFile($autoloader, $mod_path . DIRECTORY_SEPARATOR . "autoload.php", $force);
317
+        return $this->writeTemplateToFile($autoloader, $mod_path.DIRECTORY_SEPARATOR."autoload.php", $force);
319 318
     }
320 319
 
321 320
     /**
@@ -335,7 +334,7 @@  discard block
 block discarded – undo
335 334
             "db" => $this->config->get("db_name"),
336 335
         ));
337 336
         return $this->writeTemplateToFile($schema,
338
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml",
337
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml",
339 338
             $force);
340 339
     }
341 340
 
@@ -358,7 +357,7 @@  discard block
 block discarded – undo
358 357
             "namespace" => preg_replace('/(\\\|\/)/', '', $module),
359 358
         ));
360 359
         return $this->writeTemplateToFile($build_properties,
361
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml",
360
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml",
362 361
             $force);
363 362
     }
364 363
 
@@ -376,7 +375,7 @@  discard block
 block discarded – undo
376 375
             "module" => $module,
377 376
         ));
378 377
         return $this->writeTemplateToFile($index,
379
-            $mod_path . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig",
378
+            $mod_path.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig",
380 379
             $force);
381 380
     }
382 381
 
@@ -394,11 +393,11 @@  discard block
 block discarded – undo
394 393
             try {
395 394
                 $this->cache->storeData($filename, $fileContent, Cache::TEXT, true);
396 395
                 $created = true;
397
-            } catch (\Exception $e) {
396
+            }catch (\Exception $e) {
398 397
                 $this->log->errorLog($e->getMessage());
399 398
             }
400
-        } else {
401
-            $this->log->errorLog($filename . _(' not exists or cant write'));
399
+        }else {
400
+            $this->log->errorLog($filename._(' not exists or cant write'));
402 401
         }
403 402
         return $created;
404 403
     }
@@ -423,7 +422,7 @@  discard block
 block discarded – undo
423 422
         ));
424 423
 
425 424
         return $this->writeTemplateToFile($controller,
426
-            $mod_path . DIRECTORY_SEPARATOR . "Api" . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true);
425
+            $mod_path.DIRECTORY_SEPARATOR."Api".DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true);
427 426
     }
428 427
 
429 428
     /**
@@ -446,7 +445,7 @@  discard block
 block discarded – undo
446 445
             "class" => $class,
447 446
         ));
448 447
 
449
-        return $this->writeTemplateToFile($controller, $mod_path . DIRECTORY_SEPARATOR . "Api" . DIRECTORY_SEPARATOR . "{$api}.php", $force);
448
+        return $this->writeTemplateToFile($controller, $mod_path.DIRECTORY_SEPARATOR."Api".DIRECTORY_SEPARATOR."{$api}.php", $force);
450 449
     }
451 450
 
452 451
     /**
@@ -460,12 +459,12 @@  discard block
 block discarded – undo
460 459
     {
461 460
         if (file_exists($filename_path)) {
462 461
             $destfolder = basename($filename_path);
463
-            if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) {
462
+            if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) {
464 463
                 if (is_dir($filename_path)) {
465
-                    self::copyr($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
466
-                } else {
467
-                    if (@copy($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) {
468
-                        throw new ConfigException("Can't copy " . $filename_path . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
464
+                    self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
465
+                }else {
466
+                    if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) {
467
+                        throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
469 468
                     }
470 469
                 }
471 470
             }
@@ -484,10 +483,10 @@  discard block
 block discarded – undo
484 483
         Config::createDir($dst);
485 484
         while (false !== ($file = readdir($dir))) {
486 485
             if (($file != '.') && ($file != '..')) {
487
-                if (is_dir($src . '/' . $file)) {
488
-                    self::copyr($src . '/' . $file, $dst . '/' . $file);
489
-                } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) {
490
-                    throw new ConfigException("Can't copy " . $src . " to " . $dst);
486
+                if (is_dir($src.'/'.$file)) {
487
+                    self::copyr($src.'/'.$file, $dst.'/'.$file);
488
+                } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) {
489
+                    throw new ConfigException("Can't copy ".$src." to ".$dst);
491 490
                 }
492 491
             }
493 492
         }
Please login to merge, or discard this patch.
src/base/config/Config.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     protected function init()
48 48
     {
49
-        if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . "config.json")) {
49
+        if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json")) {
50 50
             $this->loadConfigData();
51 51
         }
52 52
         return $this;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function getTemplatePath()
118 118
     {
119
-        $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
119
+        $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR;
120 120
         return realpath($path);
121 121
     }
122 122
 
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
         $final_data = self::saveExtraParams($data);
164 164
         $saved = false;
165 165
         try {
166
-            Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "config.json", $final_data, Cache::JSON, true);
166
+            Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json", $final_data, Cache::JSON, true);
167 167
             Config::getInstance()->loadConfigData();
168 168
             $saved = true;
169
-        } catch (ConfigException $e) {
169
+        }catch (ConfigException $e) {
170 170
             Logger::log($e->getMessage(), LOG_ERR);
171 171
         }
172 172
         return $saved;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      */
199 199
     public function getPropelParams()
200 200
     {
201
-        return Cache::getInstance()->getDataFromFile(__DIR__ . DIRECTORY_SEPARATOR . 'properties.json', Cache::JSON, true);
201
+        return Cache::getInstance()->getDataFromFile(__DIR__.DIRECTORY_SEPARATOR.'properties.json', Cache::JSON, true);
202 202
     }
203 203
 
204 204
     /**
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
     {
211 211
         try {
212 212
             if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) {
213
-                throw new \Exception(_('Can\'t create directory ') . $dir);
213
+                throw new \Exception(_('Can\'t create directory ').$dir);
214 214
             }
215
-        } catch (\Exception $e) {
215
+        }catch (\Exception $e) {
216 216
             Logger::log($e->getMessage(), LOG_WARNING);
217 217
             if (!file_exists(dirname($dir))) {
218
-                throw new ConfigException($e->getMessage() . $dir);
218
+                throw new ConfigException($e->getMessage().$dir);
219 219
             }
220 220
         }
221 221
     }
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $rootDirs = array("css", "js", "media", "font");
229 229
         foreach ($rootDirs as $dir) {
230
-            if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) {
230
+            if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) {
231 231
                 try {
232
-                    @shell_exec("rm -rf " . WEB_DIR . DIRECTORY_SEPARATOR . $dir);
233
-                } catch (\Exception $e) {
232
+                    @shell_exec("rm -rf ".WEB_DIR.DIRECTORY_SEPARATOR.$dir);
233
+                }catch (\Exception $e) {
234 234
                     Logger::log($e->getMessage());
235 235
                 }
236 236
             }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
      */
243 243
     public function loadConfigData()
244 244
     {
245
-        $this->config = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "config.json",
245
+        $this->config = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json",
246 246
             Cache::JSON,
247 247
             TRUE) ?: [];
248 248
         $this->debug = (array_key_exists('debug', $this->config)) ? (bool)$this->config['debug'] : FALSE;
Please login to merge, or discard this patch.