Passed
Push — master ( 14f6bb...8d1d43 )
by Fran
07:59 queued 04:09
created
src/base/types/AuthApi.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
     {
27 27
         $namespace = explode('\\', $this->getModelTableMap());
28 28
         $module = strtolower($namespace[0]);
29
-        $secret = Config::getInstance()->get($module . '.api.secret');
29
+        $secret = Config::getInstance()->get($module.'.api.secret');
30 30
         if (NULL === $secret) {
31 31
             $secret = Config::getInstance()->get("api.secret");
32 32
         }
33 33
         if (NULL === $secret) {
34 34
             $auth = TRUE;
35
-        } else {
35
+        }else {
36 36
             $token = Request::getInstance()->getHeader('X-API-SEC-TOKEN');
37 37
             if (array_key_exists('API_TOKEN', $this->query)) {
38 38
                 $token = $this->query['API_TOKEN'];
Please login to merge, or discard this patch.
src/base/extension/AssetsNode.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@
 block discarded – undo
30 30
         $scripts = $this->getNode("scripts");
31 31
 
32 32
         //Creamos el parser
33
-        $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\'' . $this->type . '\')')
33
+        $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\''.$this->type.'\')')
34 34
             ->raw(";\n");
35 35
 
36 36
         //Asociamos el hash
37
-        $compiler->write('$parser->setHash(\'' . $this->hash . '\')')
37
+        $compiler->write('$parser->setHash(\''.$this->hash.'\')')
38 38
             ->raw(";\n");
39 39
 
40 40
         //Asociamos los ficheros
41 41
         foreach ($scripts->getAttribute("value") as $value) {
42
-            $compiler->write('$parser->addFile(\'' . $value . '\')')->raw(";\n");
42
+            $compiler->write('$parser->addFile(\''.$value.'\')')->raw(";\n");
43 43
         }
44 44
 
45 45
         //Procesamos los ficheros
Please login to merge, or discard this patch.
src/base/extension/AssetsTokenParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
139 139
         $tmp = array();
140 140
         if (NULL === $node) {
141 141
             $node = $value;
142
-        } else {
142
+        }else {
143 143
             $tmp = $this->getTmpAttribute($node);
144 144
         }
145 145
         $tmp[] = $value->getAttribute("value");
Please login to merge, or discard this patch.
src/base/Service.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     /**
117 117
      * Add request param
118 118
      *
119
-     * @param $key
119
+     * @param integer $key
120 120
      * @param null $value
121 121
      *
122 122
      * @return \PSFS\base\Service
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
     }
154 154
 
155 155
     /**
156
-     * @param $header
157
-     * @param null $content
156
+     * @param string $header
157
+     * @param string $content
158 158
      *
159 159
      * @return $this
160 160
      */
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     protected $isJson = true;
60 60
 
61 61
     private function closeConnection() {
62
-        if(null !== $this->con) {
62
+        if (null !== $this->con) {
63 63
             curl_close($this->con);
64 64
         }
65 65
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         $this->url = NULL;
240 240
         $this->params = array();
241 241
         $this->headers = array();
242
-        Logger::log("Context service for " . get_called_class() . " cleared!");
242
+        Logger::log("Context service for ".get_called_class()." cleared!");
243 243
         $this->closeConnection();
244 244
     }
245 245
 
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
     }
282 282
 
283 283
     protected function applyOptions() {
284
-        if(count($this->options)) {
284
+        if (count($this->options)) {
285 285
             curl_setopt_array($this->con, $this->options);
286 286
         }
287 287
     }
288 288
 
289 289
     protected function applyHeaders() {
290 290
         $headers = [];
291
-        foreach($this->headers as $key => $value) {
292
-            $headers[] = $key . ': ' . $value;
291
+        foreach ($this->headers as $key => $value) {
292
+            $headers[] = $key.': '.$value;
293 293
         }
294
-        if(count($headers)) {
294
+        if (count($headers)) {
295 295
             curl_setopt($this->con, CURLOPT_HTTPHEADER, $headers);
296 296
         }
297 297
     }
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
                 break;
306 306
             case 'POST':
307 307
                 $this->addOption(CURLOPT_CUSTOMREQUEST, "POST");
308
-                if($this->getIsJson()) {
308
+                if ($this->getIsJson()) {
309 309
                     $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params));
310
-                } else {
310
+                }else {
311 311
                     $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params));
312 312
                 }
313 313
                 break;
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
             case 'PUT':
318 318
                 $this->addOption(CURLOPT_CUSTOMREQUEST, "PUT");
319 319
 
320
-                if($this->getIsJson()) {
320
+                if ($this->getIsJson()) {
321 321
                     $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params));
322
-                } else {
322
+                }else {
323 323
                     $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params));
324 324
                 }
325 325
                 break;
326 326
             case 'PATCH':
327 327
                 $this->addOption(CURLOPT_CUSTOMREQUEST, "PATCH");
328
-                if($this->getIsJson()) {
328
+                if ($this->getIsJson()) {
329 329
                     $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params));
330
-                } else {
330
+                }else {
331 331
                     $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params));
332 332
                 }
333 333
                 break;
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
         $this->setDefaults();
345 345
         $this->applyOptions();
346 346
         $this->applyHeaders();
347
-        if('debug' === Config::getParam('log.level')) {
347
+        if ('debug' === Config::getParam('log.level')) {
348 348
             curl_setopt($this->con, CURLOPT_VERBOSE, true);
349 349
             $verbose = fopen('php://temp', 'w+');
350 350
             curl_setopt($this->con, CURLOPT_STDERR, $verbose);
351 351
         }
352 352
         $result = curl_exec($this->con);
353 353
         $this->result = json_decode($result, true);
354
-        if('debug' === Config::getParam('log.level')) {
354
+        if ('debug' === Config::getParam('log.level')) {
355 355
             rewind($verbose);
356 356
             $verboseLog = stream_get_contents($verbose);
357 357
             Logger::log($verboseLog, LOG_DEBUG, [
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                 'url' => $this->getUrl(),
361 361
             ]);
362 362
         }
363
-        Logger::log($this->url . ' response: ', LOG_DEBUG, $this->result);
363
+        Logger::log($this->url.' response: ', LOG_DEBUG, $this->result);
364 364
         $this->info = curl_getinfo($this->con);
365 365
     }
366 366
 
Please login to merge, or discard this patch.
src/base/types/helpers/SecurityHelper.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         if (!Config::getInstance()->checkTryToSaveConfig()
30 30
             && (preg_match('/^\/(admin|setup\-admin)/i', $route) || NULL !== Config::getInstance()->get('restricted'))
31 31
         ) {
32
-            if (null === Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true)) {
32
+            if (null === Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true)) {
33 33
                 throw new AdminCredentialsException();
34 34
             }
35 35
             if (!Security::getInstance()->checkAdmin()) {
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
         $token = '';
50 50
         $ct = strlen($ts);
51 51
         for ($i = 0; $i < $ct; $i++) {
52
-            $token = substr($hash, $i, 1) .
53
-                    substr($ts, $i, 1) .
52
+            $token = substr($hash, $i, 1).
53
+                    substr($ts, $i, 1).
54 54
                     $token;
55 55
         }
56 56
         return $token;
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
         $charsLength = strlen(self::RAND_SEP) - 1;
69 69
         $tsLength = strlen($ts);
70 70
         $i = 0;
71
-        $ct = ceil($hashRest / 4);
72
-        $part = substr($hash, $tsLength + $ct * $i, $ct);
73
-        while(false !== $part) {
74
-            $mixedToken .= $part .
75
-                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1) .
71
+        $ct = ceil($hashRest/4);
72
+        $part = substr($hash, $tsLength + $ct*$i, $ct);
73
+        while (false !== $part) {
74
+            $mixedToken .= $part.
75
+                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1).
76 76
                 substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1);
77
-            $part = substr($hash, $tsLength + $ct * $i, $ct);
77
+            $part = substr($hash, $tsLength + $ct*$i, $ct);
78 78
             $i++;
79 79
         }
80
-        return $mixedToken . $token;
80
+        return $mixedToken.$token;
81 81
     }
82 82
 
83 83
     /**
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private static function getTs($isOdd = null) {
88 88
         $ts = time();
89
-        $tsIsOdd = (bool)((int)substr($ts, -1) % 2);
90
-        if(false === $isOdd && !$tsIsOdd) {
89
+        $tsIsOdd = (bool)((int)substr($ts, -1)%2);
90
+        if (false === $isOdd && !$tsIsOdd) {
91 91
             $ts--;
92
-        } elseif(true === $isOdd && !$tsIsOdd) {
92
+        } elseif (true === $isOdd && !$tsIsOdd) {
93 93
             $ts--;
94 94
         }
95 95
         return $ts;
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
         $partToken = '';
122 122
         $ts = '';
123 123
         $part = strrev($part);
124
-        for($i = 0, $ct = strlen($part); $i < $ct; $i++) {
125
-            if($i % 2 == 0) {
124
+        for ($i = 0, $ct = strlen($part); $i < $ct; $i++) {
125
+            if ($i%2 == 0) {
126 126
                 $ts .= substr($part, $i, 1);
127
-            } else {
127
+            }else {
128 128
                 $partToken .= substr($part, $i, 1);
129 129
             }
130 130
         }
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
     private static function parseTokenParts(array $parts) {
140 140
         $token = '';
141 141
         list($partToken, $ts) = self::extractTs(array_pop($parts));
142
-        if($ts > 0) {
143
-            foreach($parts as $part) {
142
+        if ($ts > 0) {
143
+            foreach ($parts as $part) {
144 144
                 $token .= $part;
145 145
             }
146
-            $token = $partToken . $token;
146
+            $token = $partToken.$token;
147 147
         }
148 148
         return [$token, $ts];
149 149
     }
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
      * @return array
172 172
      */
173 173
     private static function extractTokenParts($token) {
174
-        for($i = 0, $ct = strlen(self::RAND_SEP); $i < $ct; $i++) {
175
-            $token = str_replace(substr(self::RAND_SEP,$i,1), "|", $token);
174
+        for ($i = 0, $ct = strlen(self::RAND_SEP); $i < $ct; $i++) {
175
+            $token = str_replace(substr(self::RAND_SEP, $i, 1), "|", $token);
176 176
         }
177 177
         return array_unique(explode('||', $token));
178 178
     }
Please login to merge, or discard this patch.
src/services/GeneratorService.php 2 patches
Doc Comments   +3 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
      */
@@ -85,7 +85,6 @@  discard block
 block discarded – undo
85 85
      * Service that creates the root paths for the modules
86 86
      * @param string $module
87 87
      * @param string $mod_path
88
-     * @param boolean $isModule
89 88
      */
90 89
     private function createModulePath($module, $mod_path)
91 90
     {
@@ -99,7 +98,7 @@  discard block
 block discarded – undo
99 98
      * Servicio que genera la estructura base
100 99
      * @param string $module
101 100
      * @param boolean $mod_path
102
-     * @return boolean
101
+     * @return boolean|null
103 102
      */
104 103
     private function createModulePathTree($module, $mod_path)
105 104
     {
@@ -464,7 +463,7 @@  discard block
 block discarded – undo
464 463
      * Method that copy resources recursively
465 464
      * @param string $dest
466 465
      * @param boolean $force
467
-     * @param $filename_path
466
+     * @param string $filename_path
468 467
      * @param boolean $debug
469 468
      */
470 469
     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);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         // Creates the src folder
93 93
         GeneratorHelper::createDir($mod_path);
94 94
         // Create module path
95
-        GeneratorHelper::createDir($mod_path . $module);
95
+        GeneratorHelper::createDir($mod_path.$module);
96 96
     }
97 97
 
98 98
     /**
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
         $paths = [
109 109
             "Api", "Api/base", "Config", "Controller", "Form", "Models", "Public", "Templates", "Services", "Test"
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
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
             "namespace" => preg_replace('/(\\\|\/)/', '', $module),
369 369
         ));
370 370
         return $this->writeTemplateToFile($build_properties,
371
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml",
371
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml",
372 372
             $force);
373 373
     }
374 374
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
             "module" => $module,
387 387
         ));
388 388
         return $this->writeTemplateToFile($index,
389
-            $mod_path . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig",
389
+            $mod_path.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig",
390 390
             $force);
391 391
     }
392 392
 
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
             try {
405 405
                 $this->cache->storeData($filename, $fileContent, Cache::TEXT, true);
406 406
                 $created = true;
407
-            } catch (\Exception $e) {
407
+            }catch (\Exception $e) {
408 408
                 $this->log->errorLog($e->getMessage());
409 409
             }
410
-        } else {
411
-            $this->log->errorLog($filename . _(' not exists or cant write'));
410
+        }else {
411
+            $this->log->errorLog($filename._(' not exists or cant write'));
412 412
         }
413 413
         return $created;
414 414
     }
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
         ));
438 438
 
439 439
         return $this->writeTemplateToFile($controller,
440
-            $mod_path . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true);
440
+            $mod_path.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true);
441 441
     }
442 442
 
443 443
     /**
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
             "class" => $class,
461 461
         ));
462 462
 
463
-        return $this->writeTemplateToFile($controller, $mod_path . DIRECTORY_SEPARATOR . "{$api}.php", $force);
463
+        return $this->writeTemplateToFile($controller, $mod_path.DIRECTORY_SEPARATOR."{$api}.php", $force);
464 464
     }
465 465
 
466 466
     /**
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
     {
475 475
         if (file_exists($filename_path)) {
476 476
             $destfolder = basename($filename_path);
477
-            if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) {
477
+            if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) {
478 478
                 if (is_dir($filename_path)) {
479
-                    self::copyr($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
480
-                } else {
481
-                    if (@copy($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) {
482
-                        throw new ConfigException("Can't copy " . $filename_path . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
479
+                    self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
480
+                }else {
481
+                    if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) {
482
+                        throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
483 483
                     }
484 484
                 }
485 485
             }
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
         GeneratorHelper::createDir($dst);
499 499
         while (false !== ($file = readdir($dir))) {
500 500
             if (($file != '.') && ($file != '..')) {
501
-                if (is_dir($src . '/' . $file)) {
502
-                    self::copyr($src . '/' . $file, $dst . '/' . $file);
503
-                } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) {
504
-                    throw new ConfigException("Can't copy " . $src . " to " . $dst);
501
+                if (is_dir($src.'/'.$file)) {
502
+                    self::copyr($src.'/'.$file, $dst.'/'.$file);
503
+                } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) {
504
+                    throw new ConfigException("Can't copy ".$src." to ".$dst);
505 505
                 }
506 506
             }
507 507
         }
Please login to merge, or discard this patch.
src/base/config/ModuleForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
             "Auth" => _("Requiere autenticación de usuario"),
35 35
             "AuthAdmin" => _("Requiere autenticación de administrador"),
36 36
         );
37
-        if(Config::getParam('psfs.auth')) {
37
+        if (Config::getParam('psfs.auth')) {
38 38
             $controllerTypes['SessionAuthApi'] = _('Requiere autenticación usando PSFS AUTH');
39 39
         }
40 40
         $this->add('module', array(
Please login to merge, or discard this patch.
src/base/types/helpers/AdminHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $routes = [];
33 33
         foreach ($systemRoutes as $route => $params) {
34
-            if(isset($params['http']) && 'GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) {
34
+            if (isset($params['http']) && 'GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) {
35 35
                 $module = strtoupper($params['module']);
36 36
                 $mode = $params["visible"] ? 'visible' : 'hidden';
37 37
                 $routes[$module][$mode][] = [
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
                 ];
42 42
             }
43 43
         }
44
-        foreach($routes as $module => &$route) {
45
-            if(array_key_exists('visible', $route)) {
44
+        foreach ($routes as $module => &$route) {
45
+            if (array_key_exists('visible', $route)) {
46 46
                 uasort($route["visible"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel');
47 47
             }
48
-            if(array_key_exists('hidden', $route)) {
48
+            if (array_key_exists('hidden', $route)) {
49 49
                 uasort($route["hidden"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel');
50 50
             }
51 51
         }
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,8 +61,8 @@  discard block
 block discarded – undo
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
         }
Please login to merge, or discard this patch.