Passed
Push — master ( be88e3...87c6b6 )
by Fran
04:17
created
src/base/extension/TemplateFunctions.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -187,8 +187,11 @@
 block discarded – undo
187 187
     private static function putResourceContent($name, $filename_path, $base, $file_path)
188 188
     {
189 189
         $data = file_get_contents($filename_path);
190
-        if (!empty($name)) file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data);
191
-        else file_put_contents($base . $file_path, $data);
190
+        if (!empty($name)) {
191
+            file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data);
192
+        } else {
193
+            file_put_contents($base . $file_path, $data);
194
+        }
192 195
     }
193 196
 
194 197
     /**
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 
40 40
         $file_path = "";
41 41
         if (!file_exists($file_path)) {
42
-            $file_path = BASE_DIR . $string;
42
+            $file_path = BASE_DIR.$string;
43 43
         }
44 44
         $filename_path = AssetsParser::findDomainPath($string, $file_path);
45 45
 
46 46
         $file_path = self::processAsset($string, $name, $return, $filename_path);
47 47
         $base_path = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl());
48
-        $return_path = (empty($name)) ? $base_path . '/' . $file_path : $name;
48
+        $return_path = (empty($name)) ? $base_path.'/'.$file_path : $name;
49 49
         return ($return) ? $return_path : '';
50 50
     }
51 51
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $router = Router::getInstance();
63 63
         try {
64 64
             return $router->getRoute($path, $absolute, $params);
65
-        } catch (\Exception $e) {
65
+        }catch (\Exception $e) {
66 66
             return $router->getRoute('', $absolute, $params);
67 67
         }
68 68
     }
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
     private static function putResourceContent($name, $filename_path, $base, $file_path)
200 200
     {
201 201
         $data = file_get_contents($filename_path);
202
-        if (!empty($name)) file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data);
203
-        else file_put_contents($base . $file_path, $data);
202
+        if (!empty($name)) file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data);
203
+        else file_put_contents($base.$file_path, $data);
204 204
     }
205 205
 
206 206
     /**
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
         if (file_exists($filename_path)) {
219 219
             list($base, $html_base, $file_path) = AssetsParser::calculateAssetPath($string, $name, $return, $filename_path);
220 220
             //Creamos el directorio si no existe
221
-            GeneratorHelper::createDir($base . $html_base);
221
+            GeneratorHelper::createDir($base.$html_base);
222 222
             //Si se ha modificado
223
-            if (!file_exists($base . $file_path) || filemtime($base . $file_path) < filemtime($filename_path)) {
223
+            if (!file_exists($base.$file_path) || filemtime($base.$file_path) < filemtime($filename_path)) {
224 224
                 if ($html_base == 'css') {
225 225
                     self::processCssLines($filename_path);
226 226
                 }
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/controller/RouteController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
             $router->simpatize();
56 56
             Security::getInstance()->setFlash("callback_message", _("Rutas generadas correctamente"));
57 57
             Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true));
58
-        } catch (\Exception $e) {
58
+        }catch (\Exception $e) {
59 59
             Logger::log($e->getMessage(), LOG_ERR);
60 60
             Security::getInstance()->setFlash("callback_message", _("Algo no ha salido bien, revisa los logs"));
61 61
             Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true));
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/base/types/helpers/GeneratorHelper.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
             $objects = scandir($dir);
20 20
             foreach ($objects as $object) {
21 21
                 if ($object != "." && $object != "..") {
22
-                    if (filetype($dir . "/" . $object) == "dir") {
23
-                        self::deleteDir($dir . "/" . $object);
24
-                    } else {
25
-                        unlink($dir . "/" . $object);
22
+                    if (filetype($dir."/".$object) == "dir") {
23
+                        self::deleteDir($dir."/".$object);
24
+                    }else {
25
+                        unlink($dir."/".$object);
26 26
                     }
27 27
                 }
28 28
             }
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $rootDirs = array("css", "js", "media", "font");
40 40
         foreach ($rootDirs as $dir) {
41
-            if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) {
41
+            if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) {
42 42
                 try {
43
-                    self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir);
44
-                } catch (\Exception $e) {
43
+                    self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir);
44
+                }catch (\Exception $e) {
45 45
                     Logger::log($e->getMessage());
46 46
                 }
47 47
             }
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
     {
58 58
         try {
59 59
             if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) {
60
-                throw new \Exception(_('Can\'t create directory ') . $dir);
60
+                throw new \Exception(_('Can\'t create directory ').$dir);
61 61
             }
62
-        } catch (\Exception $e) {
62
+        }catch (\Exception $e) {
63 63
             Logger::log($e->getMessage(), LOG_WARNING);
64 64
             if (!file_exists(dirname($dir))) {
65
-                throw new GeneratorException($e->getMessage() . $dir);
65
+                throw new GeneratorException($e->getMessage().$dir);
66 66
             }
67 67
         }
68 68
     }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public static function getTemplatePath()
75 75
     {
76
-        $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
76
+        $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR;
77 77
         return realpath($path);
78 78
     }
79 79
 
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
      * @throws GeneratorException
92 92
      */
93 93
     public static function checkCustomNamespaceApi($namespace) {
94
-        if(!empty($namespace)) {
95
-            if(class_exists($namespace)) {
94
+        if (!empty($namespace)) {
95
+            if (class_exists($namespace)) {
96 96
                 $reflector = new \ReflectionClass($namespace);
97
-                if(!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) {
97
+                if (!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) {
98 98
                     throw new GeneratorException(_('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501);
99
-                } elseif(!$reflector->isAbstract()) {
99
+                } elseif (!$reflector->isAbstract()) {
100 100
                     throw new GeneratorException(_('La clase definida debe ser abstracta'), 501);
101 101
                 }
102
-            } else {
102
+            }else {
103 103
                 throw new GeneratorException(_('La clase definida para extender la API no existe'), 501);
104 104
             }
105 105
         }
Please login to merge, or discard this patch.
src/functions.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,10 @@
 block discarded – undo
31 31
     function getallheaders()
32 32
     {
33 33
         $headers = array();
34
-        foreach ($_SERVER as $h => $v)
35
-            if (preg_match('/HTTP_(.+)/', $h, $hp))
34
+        foreach ($_SERVER as $h => $v) {
35
+                    if (preg_match('/HTTP_(.+)/', $h, $hp))
36 36
                 $headers[$hp[1]] = $v;
37
+        }
37 38
         return $headers;
38 39
     }
39 40
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@
 block discarded – undo
48 48
     /* @var $file SplFileInfo */
49 49
     foreach ($finder as $file) {
50 50
         $path = $file->getRealPath();
51
-        if(!in_array($path, $loaded_files)) {
51
+        if (!in_array($path, $loaded_files)) {
52 52
             $loaded_files[] = $path;
53 53
             require_once($path);
54 54
         }
55 55
     }
56 56
 }
57 57
 
58
-if(!function_exists('t')) {
58
+if (!function_exists('t')) {
59 59
     function t($message, $key = null, $reload = false) {
60 60
         return CustomTranslateExtension::_($message, $key, $reload);
61 61
     }
Please login to merge, or discard this patch.
src/base/types/traits/BoostrapTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,4 @@
 block discarded – undo
7 7
  */
8 8
 Trait BoostrapTrait {}
9 9
 
10
-require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php';
11 10
\ No newline at end of file
11
+require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php';
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
src/controller/DocumentorController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $download = $this->getRequest()->get('download') ?: false;
34 34
 
35 35
         $module = $this->srv->getModules($domain);
36
-        if(empty($module)) {
36
+        if (empty($module)) {
37 37
             return Router::getInstance()->httpNotFound(null, true);
38 38
         }
39 39
         switch (strtolower($type)) {
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
         ini_restore('max_execution_time');
54 54
         ini_restore('memory_limit');
55 55
 
56
-        if($download && $type === ApiController::SWAGGER_DOC) {
56
+        if ($download && $type === ApiController::SWAGGER_DOC) {
57 57
             return $this->download(\GuzzleHttp\json_encode($doc), 'application/json', 'swagger.json');
58
-        } elseif($type === ApiController::HTML_DOC) {
58
+        } elseif ($type === ApiController::HTML_DOC) {
59 59
             return $this->render('documentation.html.twig', ["data" => json_encode($doc)]);
60
-        } else {
60
+        }else {
61 61
             return $this->json($doc, 200);
62 62
         }
63 63
     }
Please login to merge, or discard this patch.