Test Failed
Push — master ( cfdf4c...b122d3 )
by Fran
09:57
created
src/base/types/helpers/FileHelper.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class FileHelper {
10 10
     /**
11
-     * @param mixed $data
11
+     * @param string $data
12 12
      * @param string $path
13 13
      * @return int
14 14
      */
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     /**
20 20
      * @param string $path
21
-     * @return mixed|bool
21
+     * @return string|false
22 22
      */
23 23
     public static function readFile($path) {
24 24
         $data = false;
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     /**
54
-     * @param $path
55
-     * @return bool
54
+     * @param string $path
55
+     * @return boolean|null
56 56
      */
57 57
     public static function deleteDir($path) {
58 58
         (new Filesystem())->remove($path);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public static function readFile($path) {
24 24
         $data = false;
25
-        if(file_exists($path)) {
25
+        if (file_exists($path)) {
26 26
             $data = file_get_contents($path);
27 27
         }
28 28
         return $data;
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @return string
36 36
      */
37 37
     public static function generateHashFilename($verb, $slug, array $query = []) {
38
-        return sha1(strtolower($verb) . " " . $slug . " " . strtolower(http_build_query($query)));
38
+        return sha1(strtolower($verb)." ".$slug." ".strtolower(http_build_query($query)));
39 39
     }
40 40
 
41 41
     /**
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     public static function generateCachePath(array $action, array $query = []) {
47 47
         $class = GeneratorHelper::extractClassFromNamespace($action['class']);
48 48
         $filename = self::generateHashFilename($action["http"], $action["slug"], $query);
49
-        $subPath = substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2);
50
-        return $action['module'] . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $action['method'] . DIRECTORY_SEPARATOR . $subPath . DIRECTORY_SEPARATOR;
49
+        $subPath = substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2);
50
+        return $action['module'].DIRECTORY_SEPARATOR.$class.DIRECTORY_SEPARATOR.$action['method'].DIRECTORY_SEPARATOR.$subPath.DIRECTORY_SEPARATOR;
51 51
     }
52 52
 
53 53
     /**
Please login to merge, or discard this patch.
src/base/types/helpers/I18nHelper.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
     /**
20 20
      * @param string $default
21
-     * @return array|mixed|string
21
+     * @return string
22 22
      */
23 23
     private static function extractLocale($default = null)
24 24
     {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
                 list($BrowserLocales[$i]) = explode(";", $BrowserLocales[$i]); //trick for "en;q=0.8"
30 30
             }
31 31
             $locale = array_shift($BrowserLocales);
32
-        } else {
32
+        }else {
33 33
             $locale = strtolower($locale);
34 34
         }
35 35
         if (false !== strpos($locale, '_')) {
36 36
             $locale = explode('_', $locale);
37 37
             if ($locale[0] == 'en') {
38
-                $locale = $locale[0] . '_GB';
39
-            } else {
40
-                $locale = $locale[0] . '_' . strtoupper($locale[1]);
38
+                $locale = $locale[0].'_GB';
39
+            }else {
40
+                $locale = $locale[0].'_'.strtoupper($locale[1]);
41 41
             }
42
-        } else {
42
+        }else {
43 43
             if (strtolower($locale) === 'en') {
44 44
                 $locale = 'en_GB';
45
-            } else {
46
-                $locale = $locale . '_' . strtoupper($locale);
45
+            }else {
46
+                $locale = $locale.'_'.strtoupper($locale);
47 47
             }
48 48
         }
49 49
         if (!in_array($locale, self::$langs)) {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $translations = array();
65 65
         if (file_exists($absoluteTranslationFileName)) {
66 66
             @include($absoluteTranslationFileName);
67
-        } else {
67
+        }else {
68 68
             Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE);
69 69
         }
70 70
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
     public static function setLocale()
78 78
     {
79 79
         $locale = self::extractLocale('es_ES');
80
-        Logger::log('Set locale to project [' . $locale . ']');
80
+        Logger::log('Set locale to project ['.$locale.']');
81 81
         // Load translations
82
-        putenv("LC_ALL=" . $locale);
82
+        putenv("LC_ALL=".$locale);
83 83
         setlocale(LC_ALL, $locale);
84 84
         // Load the locale path
85
-        $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale';
86
-        Logger::log('Set locale dir ' . $locale_path);
85
+        $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale';
86
+        Logger::log('Set locale dir '.$locale_path);
87 87
         GeneratorHelper::createDir($locale_path);
88 88
         bindtextdomain('translations', $locale_path);
89 89
         textdomain('translations');
Please login to merge, or discard this patch.
src/base/Template.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $dump = '';
114 114
         try {
115 115
             $dump = $this->tpl->render($tpl, $vars);
116
-        } catch (\Exception $e) {
116
+        }catch (\Exception $e) {
117 117
             Logger::log($e->getMessage(), LOG_ERR);
118 118
         }
119 119
         return $dump;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     public function regenerateTemplates()
141 141
     {
142 142
         $this->generateTemplatesCache();
143
-        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", Cache::JSON, true);
143
+        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", Cache::JSON, true);
144 144
         $translations = [];
145 145
         if (is_array($domains)) {
146 146
             $translations = $this->parsePathTranslations($domains);
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
             // force compilation
163 163
             if ($file->isFile()) {
164 164
                 try {
165
-                    $this->tpl->load(str_replace($tplDir . '/', '', $file));
166
-                } catch (\Exception $e) {
165
+                    $this->tpl->load(str_replace($tplDir.'/', '', $file));
166
+                }catch (\Exception $e) {
167 167
                     Logger::log($e->getMessage(), LOG_ERR, ['file' => $e->getFile(), 'line' => $e->getLine()]);
168 168
                 }
169 169
             }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             'getFlash' => TemplateFunctions::GET_FLASH_FUNCTION,
225 225
             'getQuery' => TemplateFunctions::GET_QUERY_FUNCTION,
226 226
         ];
227
-        foreach($functions as $name => $function) {
227
+        foreach ($functions as $name => $function) {
228 228
             $this->addTemplateFunction($name, $function);
229 229
         }
230 230
     }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      */
244 244
     private function loadDomains()
245 245
     {
246
-        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, true);
246
+        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', Cache::JSON, true);
247 247
         if (null !== $domains) {
248 248
             foreach ($domains as $domain => $paths) {
249 249
                 $this->addPath($paths['template'], preg_replace('/(@|\/)/', '', $domain));
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $loader = new \Twig_Loader_Filesystem(GeneratorHelper::getTemplatePath());
260 260
         $this->tpl = new \Twig_Environment($loader, array(
261
-            'cache' => CACHE_DIR . DIRECTORY_SEPARATOR . 'twig',
261
+            'cache' => CACHE_DIR.DIRECTORY_SEPARATOR.'twig',
262 262
             'debug' => (bool)$this->debug,
263 263
             'auto_reload' => Config::getParam('twig.autoreload', TRUE),
264 264
         ));
Please login to merge, or discard this patch.
src/base/Security.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             session_start();
74 74
         }
75 75
         // Fix for phpunits
76
-        if(!isset($_SESSION)) {
76
+        if (!isset($_SESSION)) {
77 77
             $_SESSION = [];
78 78
         }
79 79
     }
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $saved = true;
135 135
         try {
136
-            $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true) ?: [];
137
-            $admins[$user['username']]['hash'] = sha1($user['username'] . $user['password']);
136
+            $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true) ?: [];
137
+            $admins[$user['username']]['hash'] = sha1($user['username'].$user['password']);
138 138
             $admins[$user['username']]['profile'] = $user['profile'];
139 139
 
140
-            Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', $admins, Cache::JSONGZ, true);
141
-        } catch(\Exception $e) {
140
+            Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', $admins, Cache::JSONGZ, true);
141
+        }catch (\Exception $e) {
142 142
             Logger::log($e->getMessage(), LOG_ERR);
143 143
             $saved = false;
144 144
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public function getAdmins()
177 177
     {
178
-        return Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true);
178
+        return Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true);
179 179
     }
180 180
 
181 181
     /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                 }
204 204
                 if (!empty($user) && !empty($admins[$user])) {
205 205
                     $auth = $admins[$user]['hash'];
206
-                    $this->authorized = ($auth == sha1($user . $pass));
206
+                    $this->authorized = ($auth == sha1($user.$pass));
207 207
                     if ($this->authorized) {
208 208
                         $this->admin = array(
209 209
                             'alias' => $user,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                         );
212 212
                         $this->setSessionKey(self::ADMIN_ID_TOKEN, serialize($this->admin));
213 213
                     }
214
-                } else {
214
+                }else {
215 215
                     $this->admin = null;
216 216
                     $this->setSessionKey(self::ADMIN_ID_TOKEN, null);
217 217
                 }
Please login to merge, or discard this patch.
src/base/dto/Dto.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@
 block discarded – undo
35 35
                 /** @var \ReflectionProperty $property */
36 36
                 foreach ($properties as $property) {
37 37
                     $value = $property->getValue($this);
38
-                    if(is_object($value) && method_exists($value, 'toArray')) {
38
+                    if (is_object($value) && method_exists($value, 'toArray')) {
39 39
                         $dto[$property->getName()] = $value->toArray();
40
-                    } else {
40
+                    }else {
41 41
                         $dto[$property->getName()] = $property->getValue($this);
42 42
                     }
43 43
                 }
44 44
             }
45
-        } catch (\Exception $e) {
46
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
45
+        }catch (\Exception $e) {
46
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
47 47
         }
48 48
         return $dto;
49 49
     }
Please login to merge, or discard this patch.
src/controller/GeneratorController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function generateModule()
36 36
     {
37
-        Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri());
37
+        Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri());
38 38
         /* @var $form \PSFS\base\config\ConfigForm */
39 39
         $form = new ModuleForm();
40 40
         $form->build();
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
                 $this->gen->createStructureModule($module, false, $type, $apiClass);
66 66
                 Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente")));
67 67
                 Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true));
68
-            } catch (\Exception $e) {
69
-                Logger::getInstance()->infoLog($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]");
68
+            }catch (\Exception $e) {
69
+                Logger::getInstance()->infoLog($e->getMessage()." [".$e->getFile().":".$e->getLine()."]");
70 70
                 Security::getInstance()->setFlash("callback_message", $e->getMessage());
71 71
             }
72 72
         }
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 
78 78
     public static function createRoot($path = WEB_DIR, OutputInterface $output = null) {
79 79
 
80
-        if(null === $output) {
80
+        if (null === $output) {
81 81
             $output = new ConsoleOutput();
82 82
         }
83 83
 
84 84
         GeneratorHelper::createDir($path);
85 85
         $paths = array("js", "css", "img", "media", "font");
86 86
         foreach ($paths as $htmlPath) {
87
-            GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath);
87
+            GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath);
88 88
         }
89 89
 
90 90
         // Generates the root needed files
@@ -96,18 +96,18 @@  discard block
 block discarded – undo
96 96
             'robots' => 'robots.txt',
97 97
         ];
98 98
         foreach ($files as $templates => $filename) {
99
-            $text = Template::getInstance()->dump("generator/html/" . $templates . '.html.twig');
100
-            if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) {
101
-                $output->writeln('Can\t create the file ' . $filename);
102
-            } else {
103
-                $output->writeln($filename . ' created successfully');
99
+            $text = Template::getInstance()->dump("generator/html/".$templates.'.html.twig');
100
+            if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) {
101
+                $output->writeln('Can\t create the file '.$filename);
102
+            }else {
103
+                $output->writeln($filename.' created successfully');
104 104
             }
105 105
         }
106 106
 
107 107
         //Export base locale translations
108
-        if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) {
109
-            GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
110
-            GeneratorService::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
108
+        if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) {
109
+            GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
110
+            GeneratorService::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale');
111 111
         }
112 112
     }
113 113
 }
114 114
\ No newline at end of file
Please login to merge, or discard this patch.
src/base/config/ConfigForm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,9 +82,9 @@
 block discarded – undo
82 82
             "class" => "btn-warning md-default",
83 83
             "icon" => "fa-plus",
84 84
         ];
85
-        if(Config::getParam('admin.version', 'v1') === 'v1') {
86
-            $add["onclick"] = "javascript:addNewField(document.getElementById('" . $this->getName() . "'));";
87
-        } else {
85
+        if (Config::getParam('admin.version', 'v1') === 'v1') {
86
+            $add["onclick"] = "javascript:addNewField(document.getElementById('".$this->getName()."'));";
87
+        }else {
88 88
             $add["ng-click"] = "addNewField()";
89 89
         }
90 90
         $this->addButton('submit', _("Guardar configuración"), "submit", array(
Please login to merge, or discard this patch.
src/base/types/traits/SystemTrait.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 namespace PSFS\base\types\traits;
3 3
 
4 4
 use PSFS\base\Logger;
5
-use PSFS\base\Request;
6 5
 
7 6
 /**
8 7
  * Class SystemTrait
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                 $use /= 1024;
36 36
                 break;
37 37
             case "MBytes":
38
-                $use /= (1024 * 1024);
38
+                $use /= (1024*1024);
39 39
                 break;
40 40
             case "Bytes":
41 41
             default:
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     {
61 61
         Logger::log('Added handlers for errors');
62 62
         //Warning & Notice handler
63
-        set_error_handler(function ($errno, $errstr, $errfile, $errline) {
63
+        set_error_handler(function($errno, $errstr, $errfile, $errline) {
64 64
             Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline, 'errno' => $errno]);
65 65
             return true;
66 66
         }, E_ALL | E_STRICT);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         Logger::log('Initializing stats (mem + ts)');
75 75
         if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) {
76 76
             $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT'];
77
-        } else {
77
+        }else {
78 78
             $this->ts = PSFS_START_TS;
79 79
         }
80 80
         $this->mem = PSFS_START_MEM;
Please login to merge, or discard this patch.
src/services/GeneratorService.php 2 patches
Doc Comments   +3 added lines, -3 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
      */
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      * Servicio que genera la estructura base
99 99
      * @param string $module
100 100
      * @param boolean $mod_path
101
-     * @return boolean
101
+     * @return boolean|null
102 102
      */
103 103
     private function createModulePathTree($module, $mod_path)
104 104
     {
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
      * Method that copy resources recursively
463 463
      * @param string $dest
464 464
      * @param boolean $force
465
-     * @param $filename_path
465
+     * @param string $filename_path
466 466
      * @param boolean $debug
467 467
      */
468 468
     public static function copyResources($dest, $force, $filename_path, $debug)
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 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
                 GeneratorHelper::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 = "", $apiClass = "")
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);
76 76
         $this->createModulePathTree($module, $mod_path);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         // Creates the src folder
92 92
         GeneratorHelper::createDir($mod_path);
93 93
         // Create module path
94
-        GeneratorHelper::createDir($mod_path . $module);
94
+        GeneratorHelper::createDir($mod_path.$module);
95 95
     }
96 96
 
97 97
     /**
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
             "Api", "Api/base", "Config", "Controller", "Models",
109 109
             "Public", "Templates", "Services", "Test", "Doc",
110 110
         ];
111
-        $module_path = $mod_path . $module;
111
+        $module_path = $mod_path.$module;
112 112
         foreach ($paths as $path) {
113
-            GeneratorHelper::createDir($module_path . DIRECTORY_SEPARATOR . $path);
113
+            GeneratorHelper::createDir($module_path.DIRECTORY_SEPARATOR.$path);
114 114
         }
115 115
         //Creamos las carpetas de los assets
116 116
         $htmlPaths = array("css", "js", "img", "media", "font");
117 117
         foreach ($htmlPaths as $path) {
118
-            GeneratorHelper::createDir($module_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path);
118
+            GeneratorHelper::createDir($module_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path);
119 119
         }
120 120
     }
121 121
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     private function createModuleBaseFiles($module, $mod_path, $force = false, $controllerType = '')
130 130
     {
131
-        $module_path = $mod_path . $module;
131
+        $module_path = $mod_path.$module;
132 132
         $this->generateControllerTemplate($module, $module_path, $force, $controllerType);
133 133
         $this->generateServiceTemplate($module, $module_path, $force);
134 134
         $this->genereateAutoloaderTemplate($module, $module_path, $force);
@@ -146,28 +146,28 @@  discard block
 block discarded – undo
146 146
      */
147 147
     private function createModuleModels($module, $path)
148 148
     {
149
-        $module_path = $path . $module;
150
-        $module_path = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $module_path);
149
+        $module_path = $path.$module;
150
+        $module_path = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $module_path);
151 151
         //Generamos las clases de propel y la configuración
152
-        $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR .
153
-            "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel ";
154
-        $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path .
155
-            DIRECTORY_SEPARATOR . "Config";
156
-        $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR .
157
-            "Config --output-dir=" . CORE_DIR . " --verbose";
158
-        $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n" . $exec . "build" . $opt . $schemaOpt);
159
-        $ret = shell_exec($exec . "build" . $opt . $schemaOpt);
152
+        $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR.
153
+            "vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel ";
154
+        $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.
155
+            DIRECTORY_SEPARATOR."Config";
156
+        $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR.
157
+            "Config --output-dir=".CORE_DIR." --verbose";
158
+        $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n".$exec."build".$opt.$schemaOpt);
159
+        $ret = shell_exec($exec."build".$opt.$schemaOpt);
160 160
 
161 161
         $this->log->infoLog("[GENERATOR] Generamos clases invocando a propel:\n $ret");
162
-        $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR .
163
-            $module_path . DIRECTORY_SEPARATOR . "Config" . $schemaOpt);
162
+        $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.
163
+            $module_path.DIRECTORY_SEPARATOR."Config".$schemaOpt);
164 164
         $this->log->infoLog("[GENERATOR] Generamos sql invocando a propel:\n $ret");
165 165
 
166 166
         $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array(
167 167
             "module" => $module,
168 168
         ));
169
-        $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR . "Config" .
170
-            DIRECTORY_SEPARATOR . "config.php", true);
169
+        $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR."Config".
170
+            DIRECTORY_SEPARATOR."config.php", true);
171 171
         $this->log->infoLog("Generado config genérico para propel:\n $ret");
172 172
     }
173 173
 
@@ -188,28 +188,28 @@  discard block
 block discarded – undo
188 188
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
189 189
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
190 190
             "class" => $class,
191
-            "controllerType" => $class . "Base",
191
+            "controllerType" => $class."Base",
192 192
             "is_base" => false
193 193
         ));
194
-        $controller = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" .
195
-            DIRECTORY_SEPARATOR . "{$class}Controller.php", $force);
194
+        $controller = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller".
195
+            DIRECTORY_SEPARATOR."{$class}Controller.php", $force);
196 196
 
197 197
         $controllerBody = $this->tpl->dump("generator/controller.template.twig", array(
198 198
             "module" => $module,
199 199
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
200 200
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
201
-            "class" => $class . "Base",
201
+            "class" => $class."Base",
202 202
             "service" => $class,
203 203
             "controllerType" => $controllerType,
204 204
             "is_base" => true,
205 205
             "domain" => $class,
206 206
         ));
207
-        $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" .
208
-            DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true);
207
+        $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller".
208
+            DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true);
209 209
 
210
-        $filename = $mod_path . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php";
210
+        $filename = $mod_path.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php";
211 211
         $test = true;
212
-        if(!file_exists($filename)) {
212
+        if (!file_exists($filename)) {
213 213
             $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array(
214 214
                 "module" => $module,
215 215
                 "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
     private function generateBaseApiTemplate($module, $mod_path, $force = false, $apiClass = "")
231 231
     {
232 232
         $created = true;
233
-        $modelPath = $mod_path . $module . DIRECTORY_SEPARATOR . 'Models';
234
-        $api_path = $mod_path . $module . DIRECTORY_SEPARATOR . 'Api';
233
+        $modelPath = $mod_path.$module.DIRECTORY_SEPARATOR.'Models';
234
+        $api_path = $mod_path.$module.DIRECTORY_SEPARATOR.'Api';
235 235
         if (file_exists($modelPath)) {
236 236
             $dir = dir($modelPath);
237 237
             while ($file = $dir->read()) {
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         //Generamos el fichero de configuración
260 260
         $this->log->infoLog("Generamos fichero vacío de configuración");
261 261
         return $this->writeTemplateToFile("<?php\n\t",
262
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php",
262
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php",
263 263
             $force);
264 264
     }
265 265
 
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
         //Generamos el fichero de configuración
275 275
         $this->log->infoLog("Generamos ficheros para assets base");
276 276
         $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n",
277
-            $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css",
277
+            $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css",
278 278
             $force);
279 279
         $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();",
280
-            $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js",
280
+            $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js",
281 281
             $force);
282 282
         return ($css && $js);
283 283
     }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             "class" => $class,
300 300
         ));
301 301
         return $this->writeTemplateToFile($controller,
302
-            $mod_path . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$class}Service.php",
302
+            $mod_path.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$class}Service.php",
303 303
             $force);
304 304
     }
305 305
 
@@ -318,13 +318,13 @@  discard block
 block discarded – undo
318 318
             "autoloader" => preg_replace('/(\\\|\/)/', '_', $module),
319 319
             "regex" => preg_replace('/(\\\|\/)/m', '\\\\\\\\\\\\', $module),
320 320
         ));
321
-        $autoload = $this->writeTemplateToFile($autoloader, $mod_path . DIRECTORY_SEPARATOR . "autoload.php", $force);
321
+        $autoload = $this->writeTemplateToFile($autoloader, $mod_path.DIRECTORY_SEPARATOR."autoload.php", $force);
322 322
 
323 323
         $this->log->infoLog("Generamos el phpunit");
324 324
         $phpUnitTemplate = $this->tpl->dump("generator/phpunit.template.twig", array(
325 325
             "module" => $module,
326 326
         ));
327
-        $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path . DIRECTORY_SEPARATOR . "phpunit.xml.dist", $force);
327
+        $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path.DIRECTORY_SEPARATOR."phpunit.xml.dist", $force);
328 328
         return $autoload && $phpunit;
329 329
     }
330 330
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
             "db" => $this->config->get("db_name"),
346 346
         ));
347 347
         return $this->writeTemplateToFile($schema,
348
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml",
348
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml",
349 349
             $force);
350 350
     }
351 351
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
             "namespace" => preg_replace('/(\\\|\/)/', '', $module),
364 364
         ));
365 365
         return $this->writeTemplateToFile($build_properties,
366
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml",
366
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml",
367 367
             $force);
368 368
     }
369 369
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
             "module" => $module,
382 382
         ));
383 383
         return $this->writeTemplateToFile($index,
384
-            $mod_path . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig",
384
+            $mod_path.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig",
385 385
             $force);
386 386
     }
387 387
 
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
             try {
400 400
                 $this->cache->storeData($filename, $fileContent, Cache::TEXT, true);
401 401
                 $created = true;
402
-            } catch (\Exception $e) {
402
+            }catch (\Exception $e) {
403 403
                 $this->log->errorLog($e->getMessage());
404 404
             }
405
-        } else {
406
-            $this->log->errorLog($filename . _(' not exists or cant write'));
405
+        }else {
406
+            $this->log->errorLog($filename._(' not exists or cant write'));
407 407
         }
408 408
         return $created;
409 409
     }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
         ));
433 433
 
434 434
         return $this->writeTemplateToFile($controller,
435
-            $mod_path . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true);
435
+            $mod_path.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true);
436 436
     }
437 437
 
438 438
     /**
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
             "class" => $class,
456 456
         ));
457 457
 
458
-        return $this->writeTemplateToFile($controller, $mod_path . DIRECTORY_SEPARATOR . "{$api}.php", $force);
458
+        return $this->writeTemplateToFile($controller, $mod_path.DIRECTORY_SEPARATOR."{$api}.php", $force);
459 459
     }
460 460
 
461 461
     /**
@@ -469,12 +469,12 @@  discard block
 block discarded – undo
469 469
     {
470 470
         if (file_exists($filename_path)) {
471 471
             $destfolder = basename($filename_path);
472
-            if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) {
472
+            if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) {
473 473
                 if (is_dir($filename_path)) {
474
-                    self::copyr($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
475
-                } else {
476
-                    if (@copy($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) {
477
-                        throw new ConfigException("Can't copy " . $filename_path . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
474
+                    self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
475
+                }else {
476
+                    if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) {
477
+                        throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
478 478
                     }
479 479
                 }
480 480
             }
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
         GeneratorHelper::createDir($dst);
494 494
         while (false !== ($file = readdir($dir))) {
495 495
             if (($file != '.') && ($file != '..')) {
496
-                if (is_dir($src . '/' . $file)) {
497
-                    self::copyr($src . '/' . $file, $dst . '/' . $file);
498
-                } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) {
499
-                    throw new ConfigException("Can't copy " . $src . " to " . $dst);
496
+                if (is_dir($src.'/'.$file)) {
497
+                    self::copyr($src.'/'.$file, $dst.'/'.$file);
498
+                } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) {
499
+                    throw new ConfigException("Can't copy ".$src." to ".$dst);
500 500
                 }
501 501
             }
502 502
         }
Please login to merge, or discard this patch.