Passed
Push — master ( 2ee8d2...63175f )
by Fran
02:39
created
src/autoload.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@
 block discarded – undo
21 21
             $path = str_replace("\\", DIRECTORY_SEPARATOR, $class);
22 22
 
23 23
             // filepath
24
-            $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php";
24
+            $abs_path = SOURCE_DIR.DIRECTORY_SEPARATOR.$path.".php";
25 25
             if (!file_exists($abs_path)) {
26
-                pre('→ ' . $class);
27
-                pre('→ ' . $path);
28
-                pre('→ ' . $abs_path);
26
+                pre('→ '.$class);
27
+                pre('→ '.$path);
28
+                pre('→ '.$abs_path);
29 29
             }
30 30
 
31 31
             // require the file
Please login to merge, or discard this patch.
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/types/traits/Api/ManagerTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
             "domain" => $this->getDomain(),
40 40
             "listLabel" => Api::API_LIST_NAME_FIELD,
41 41
             'modelId' => Api::API_MODEL_KEY_FIELD,
42
-            'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-' . $this->getDomain() . '-' . $this->getApi()), TRUE)),
43
-            "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain() . '-' . 'api-' . $this->getApi() . "-pk"), TRUE)),
42
+            'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-'.$this->getDomain().'-'.$this->getApi()), TRUE)),
43
+            "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain().'-'.'api-'.$this->getApi()."-pk"), TRUE)),
44 44
         ), [], '');
45 45
     }
46 46
 
Please login to merge, or discard this patch.
src/base/types/Controller.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
     public function render($template, array $vars = array(), $cookies = array(), $domain = null)
42 42
     {
43 43
         $vars['__menu__'] = $this->getMenu();
44
-        if(Config::getParam('profiling.enable')) {
44
+        if (Config::getParam('profiling.enable')) {
45 45
             $vars['__profiling__'] = Inspector::getStats();
46 46
         }
47 47
         $domain = (null === $domain) ? $this->getDomain() : $domain;
48
-        return $this->tpl->render($domain . $template, $vars, $cookies);
48
+        return $this->tpl->render($domain.$template, $vars, $cookies);
49 49
     }
50 50
 
51 51
     /**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $vars['__menu__'] = $this->getMenu();
78 78
         $domain = $domain ?: $this->getDomain();
79
-        return $this->tpl->dump($domain . $template, $vars);
79
+        return $this->tpl->dump($domain.$template, $vars);
80 80
     }
81 81
 
82 82
     /**
Please login to merge, or discard this patch.
src/base/types/helpers/FileHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public static function readFile($path) {
25 25
         $data = false;
26
-        if(file_exists($path)) {
26
+        if (file_exists($path)) {
27 27
             $data = @file_get_contents($path);
28 28
         }
29 29
         return $data;
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @return string
37 37
      */
38 38
     public static function generateHashFilename($verb, $slug, array $query = []) {
39
-        return sha1(strtolower($verb) . ' ' . $slug . ' ' . strtolower(http_build_query($query)));
39
+        return sha1(strtolower($verb).' '.$slug.' '.strtolower(http_build_query($query)));
40 40
     }
41 41
 
42 42
     /**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
     public static function generateCachePath(array $action, array $query = []) {
48 48
         $class = GeneratorHelper::extractClassFromNamespace($action['class']);
49 49
         $filename = self::generateHashFilename($action['http'], $action['slug'], $query);
50
-        $subPath = substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2);
51
-        return $action['module'] . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $action['method'] . DIRECTORY_SEPARATOR . $subPath . DIRECTORY_SEPARATOR;
50
+        $subPath = substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2);
51
+        return $action['module'].DIRECTORY_SEPARATOR.$class.DIRECTORY_SEPARATOR.$action['method'].DIRECTORY_SEPARATOR.$subPath.DIRECTORY_SEPARATOR;
52 52
     }
53 53
 
54 54
     /**
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
     }
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
     public static function save($user)
128 128
     {
129 129
         $saved = true;
130
-        $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true) ?: [];
131
-        $admins[$user['username']]['hash'] = sha1($user['username'] . $user['password']);
130
+        $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true) ?: [];
131
+        $admins[$user['username']]['hash'] = sha1($user['username'].$user['password']);
132 132
         $admins[$user['username']]['profile'] = $user['profile'];
133 133
 
134
-        Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', $admins, Cache::JSONGZ, true);
134
+        Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', $admins, Cache::JSONGZ, true);
135 135
         return $saved;
136 136
     }
137 137
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function getAdmins()
176 176
     {
177
-        return Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true);
177
+        return Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true);
178 178
     }
179 179
 
180 180
     /**
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
                 }
200 200
                 if (!empty($user) && !empty($admins[$user])) {
201 201
                     $auth = $admins[$user]['hash'];
202
-                    $this->authorized = ($auth === sha1($user . $pass));
202
+                    $this->authorized = ($auth === sha1($user.$pass));
203 203
                     if ($this->authorized) {
204
-                        $this->updateAdmin($user , $admins[$user]['profile']);
204
+                        $this->updateAdmin($user, $admins[$user]['profile']);
205 205
                         ResponseHelper::setCookieHeaders([
206 206
                             [
207 207
                                 'name' => $this->getHash(),
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                         ]);
213 213
                         $this->setSessionKey(self::LOGGED_USER_TOKEN, base64_encode("{$user}:{$pass}"));
214 214
                     }
215
-                } else {
215
+                }else {
216 216
                     $this->admin = null;
217 217
                     $this->setSessionKey(self::ADMIN_ID_TOKEN, null);
218 218
                 }
Please login to merge, or discard this patch.
src/bootstrap.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@
 block discarded – undo
29 29
         public static function load() {
30 30
             if(!self::$loaded) {
31 31
                 defined('PSFS_BOOTSTRAP_LOADED') or define('PSFS_BOOTSTRAP_LOADED', true);
32
-                if(class_exists("\\PSFS\\base\\Logger")) \PSFS\base\Logger::log('Bootstrap initialized', LOG_INFO);
32
+                if(class_exists("\\PSFS\\base\\Logger")) {
33
+                    \PSFS\base\Logger::log('Bootstrap initialized', LOG_INFO);
34
+                }
33 35
                 self::$loaded = true;
34 36
             }
35 37
         }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,26 +4,26 @@  discard block
 block discarded – undo
4 4
 defined('PSFS_START_MEM') or define('PSFS_START_MEM', memory_get_usage());
5 5
 defined('PSFS_START_TS') or define('PSFS_START_TS', microtime(true));
6 6
 
7
-if(defined('PSFS_PHAR_DIR') && file_exists(PSFS_PHAR_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'environment.php')) {
8
-    @require_once PSFS_PHAR_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'environment.php';
7
+if (defined('PSFS_PHAR_DIR') && file_exists(PSFS_PHAR_DIR.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'environment.php')) {
8
+    @require_once PSFS_PHAR_DIR.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'environment.php';
9 9
 }
10 10
 
11 11
 defined('SOURCE_DIR') or define('SOURCE_DIR', __DIR__);
12 12
 if (preg_match('/vendor/', SOURCE_DIR)) {
13
-    defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
14
-    defined('CORE_DIR') or define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
15
-} else {
16
-    defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
17
-    defined('CORE_DIR') or define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
13
+    defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');
14
+    defined('CORE_DIR') or define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src');
15
+}else {
16
+    defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..');
17
+    defined('CORE_DIR') or define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules');
18 18
 }
19
-defined('VENDOR_DIR') or define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor');
20
-defined('LOG_DIR') or define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
21
-defined('CACHE_DIR') or define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
22
-defined('CONFIG_DIR') or define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
23
-defined('WEB_DIR') or define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
24
-defined('LOCALE_DIR') or define('LOCALE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
19
+defined('VENDOR_DIR') or define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor');
20
+defined('LOG_DIR') or define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
21
+defined('CACHE_DIR') or define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache');
22
+defined('CONFIG_DIR') or define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config');
23
+defined('WEB_DIR') or define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html');
24
+defined('LOCALE_DIR') or define('LOCALE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'locale');
25 25
 
26
-if(!class_exists(bootstrap::class)) {
26
+if (!class_exists(bootstrap::class)) {
27 27
     /**
28 28
      * Class Bootstrap
29 29
      * @package PSFS
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
     class bootstrap {
32 32
         protected static $loaded = false;
33 33
         public static function load() {
34
-            if(!self::$loaded) {
34
+            if (!self::$loaded) {
35 35
                 defined('PSFS_BOOTSTRAP_LOADED') or define('PSFS_BOOTSTRAP_LOADED', true);
36
-                if(class_exists("\\PSFS\\base\\Logger")) \PSFS\base\Logger::log('Bootstrap initialized', LOG_INFO);
36
+                if (class_exists("\\PSFS\\base\\Logger")) \PSFS\base\Logger::log('Bootstrap initialized', LOG_INFO);
37 37
                 self::$loaded = true;
38 38
             }
39 39
         }
Please login to merge, or discard this patch.
src/base/dto/JsonResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
         $this->success = $result;
44 44
         $this->total = $total ?: (is_array($data) ? count($data) : 0);
45 45
         $this->pages = $pages;
46
-        if(null !== $message) {
46
+        if (null !== $message) {
47 47
             $this->message = $message;
48 48
         }
49 49
     }
Please login to merge, or discard this patch.