Passed
Push — master ( e34772...4b846c )
by Fran
02:55
created
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   +17 added lines, -17 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
     }
@@ -302,16 +302,16 @@  discard block
 block discarded – undo
302 302
             case 'GET':
303 303
             default:
304 304
                 $this->addOption(CURLOPT_CUSTOMREQUEST, "GET");
305
-                if(!empty($this->params)) {
305
+                if (!empty($this->params)) {
306 306
                     $sep = !preg_match('/\?/', $this->getUrl()) ? '?' : '';
307
-                    $this->setUrl($this->getUrl() . $sep . http_build_query($this->params));
307
+                    $this->setUrl($this->getUrl().$sep.http_build_query($this->params));
308 308
                 }
309 309
                 break;
310 310
             case 'POST':
311 311
                 $this->addOption(CURLOPT_CUSTOMREQUEST, "POST");
312
-                if($this->getIsJson()) {
312
+                if ($this->getIsJson()) {
313 313
                     $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params));
314
-                } else {
314
+                }else {
315 315
                     $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params));
316 316
                 }
317 317
                 break;
@@ -321,17 +321,17 @@  discard block
 block discarded – undo
321 321
             case 'PUT':
322 322
                 $this->addOption(CURLOPT_CUSTOMREQUEST, "PUT");
323 323
 
324
-                if($this->getIsJson()) {
324
+                if ($this->getIsJson()) {
325 325
                     $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params));
326
-                } else {
326
+                }else {
327 327
                     $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params));
328 328
                 }
329 329
                 break;
330 330
             case 'PATCH':
331 331
                 $this->addOption(CURLOPT_CUSTOMREQUEST, "PATCH");
332
-                if($this->getIsJson()) {
332
+                if ($this->getIsJson()) {
333 333
                     $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params));
334
-                } else {
334
+                }else {
335 335
                     $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params));
336 336
                 }
337 337
                 break;
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
         $this->setDefaults();
349 349
         $this->applyOptions();
350 350
         $this->applyHeaders();
351
-        if('debug' === Config::getParam('log.level')) {
351
+        if ('debug' === Config::getParam('log.level')) {
352 352
             curl_setopt($this->con, CURLOPT_VERBOSE, true);
353 353
             $verbose = fopen('php://temp', 'w+');
354 354
             curl_setopt($this->con, CURLOPT_STDERR, $verbose);
355 355
         }
356 356
         $result = curl_exec($this->con);
357 357
         $this->result = $this->isJson ? json_decode($result, true) : $result;
358
-        if('debug' === Config::getParam('log.level')) {
358
+        if ('debug' === Config::getParam('log.level')) {
359 359
             rewind($verbose);
360 360
             $verboseLog = stream_get_contents($verbose);
361 361
             Logger::log($verboseLog, LOG_DEBUG, [
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                 'url' => $this->getUrl(),
365 365
             ]);
366 366
         }
367
-        Logger::log($this->url . ' response: ', LOG_DEBUG, $this->result);
367
+        Logger::log($this->url.' response: ', LOG_DEBUG, $this->result);
368 368
         $this->info = curl_getinfo($this->con);
369 369
     }
370 370
 
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/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/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/base/Cache.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     /**
148 148
      * Método que guarda en fichero los datos pasados
149
-     * @param $path
149
+     * @param string $path
150 150
      * @param $data
151 151
      * @param int $transform
152 152
      * @param boolean $absolute
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
     /**
203 203
      * Método estático que revisa si se necesita cachear la respuesta de un servicio o no
204
-     * @return integer|boolean
204
+     * @return integer
205 205
      */
206 206
     public static function needCache()
207 207
     {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         GeneratorHelper::createDir(dirname($path));
52 52
         if (false === FileHelper::writeFile($path, $data)) {
53
-            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ') . $path);
53
+            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ').$path);
54 54
         }
55 55
     }
56 56
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         Logger::log('Gathering data from cache', LOG_DEBUG, ['path' => $path]);
67 67
         $data = null;
68
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
68
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
69 69
         if (file_exists($absolutePath)) {
70 70
             $data = FileHelper::readFile($absolutePath);
71 71
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     private function hasExpiredCache($path, $expires = 300, $absolute = false)
83 83
     {
84 84
         Logger::log('Checking expiration', LOG_DEBUG, ['path' => $path]);
85
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
85
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
86 86
         $lasModificationDate = filemtime($absolutePath);
87 87
         return ($lasModificationDate + $expires <= time());
88 88
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     {
152 152
         Logger::log('Store data in cache', LOG_DEBUG, ['path' => $path]);
153 153
         $data = Cache::transformData($data, $transform);
154
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
154
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
155 155
         $this->saveTextToFile($data, $absolutePath);
156 156
     }
157 157
 
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
     {
168 168
         $data = null;
169 169
         Logger::log('Reading data from cache', LOG_DEBUG, ['path' => $path]);
170
-        if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) {
170
+        if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) {
171 171
             if (is_callable($function) && $this->hasExpiredCache($path, $expires)) {
172 172
                 $data = call_user_func($function);
173 173
                 $this->storeData($path, $data, $transform, false, $expires);
174
-            } else {
174
+            }else {
175 175
                 $data = $this->getDataFromFile($path, $transform);
176 176
             }
177 177
         }
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
      * Flush cache when save a registry
229 229
      */
230 230
     public function flushCache() {
231
-        if(Config::getParam('cache.data.enable', false)) {
231
+        if (Config::getParam('cache.data.enable', false)) {
232 232
             Logger::log('Flushing cache', LOG_DEBUG);
233 233
             $action = Security::getInstance()->getSessionKey("__CACHE__");
234
-            $hashPath = FileHelper::generateCachePath($action, $action['params']) . '..' . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
235
-            if(!file_exists($hashPath)) {
236
-                $hashPath = CACHE_DIR . DIRECTORY_SEPARATOR . $hashPath;
234
+            $hashPath = FileHelper::generateCachePath($action, $action['params']).'..'.DIRECTORY_SEPARATOR.' .. '.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
235
+            if (!file_exists($hashPath)) {
236
+                $hashPath = CACHE_DIR.DIRECTORY_SEPARATOR.$hashPath;
237 237
             }
238 238
             FileHelper::deleteDir($hashPath);
239 239
         }
Please login to merge, or discard this patch.
src/base/Singleton.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,9 +121,11 @@
 block discarded – undo
121 121
                 $cacheService->storeData($cacheFilename, $properties, $cache);
122 122
             }
123 123
             /** @var \ReflectionProperty $property */
124
-            if (!empty($properties) && is_array($properties)) foreach ($properties as $property => $class) {
124
+            if (!empty($properties) && is_array($properties)) {
125
+                foreach ($properties as $property => $class) {
125 126
                 $this->load($property, true, $class);
126 127
             }
128
+            }
127 129
             $this->setLoaded();
128 130
         } else {
129 131
             Logger::log(get_class($this) . ' already loaded', LOG_INFO);
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
     public function __construct()
17 17
     {
18
-        Logger::log(get_class($this) . ' constructor invoked');
18
+        Logger::log(get_class($this).' constructor invoked');
19 19
         $this->init();
20 20
     }
21 21
 
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
         $calledClass = get_called_class();
69 69
         try {
70 70
             $instance = InjectorHelper::constructInyectableInstance($variable, $singleton, $classNameSpace, $calledClass);
71
-            $setter = "set" . ucfirst($variable);
71
+            $setter = "set".ucfirst($variable);
72 72
             if (method_exists($calledClass, $setter)) {
73 73
                 $this->$setter($instance);
74
-            } else {
74
+            }else {
75 75
                 $this->$variable = $instance;
76 76
             }
77
-        } catch (\Exception $e) {
78
-            Logger::log($e->getMessage() . ': ' . $e->getFile() . ' [' . $e->getLine() . ']', LOG_ERR);
77
+        }catch (\Exception $e) {
78
+            Logger::log($e->getMessage().': '.$e->getFile().' ['.$e->getLine().']', LOG_ERR);
79 79
             throw $e;
80 80
         }
81 81
         return $this;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     {
89 89
         if (!$this->isLoaded()) {
90 90
             $filename = sha1(get_class($this));
91
-            $cacheFilename = "reflections" . DIRECTORY_SEPARATOR . substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2) . DIRECTORY_SEPARATOR . $filename . ".json";
91
+            $cacheFilename = "reflections".DIRECTORY_SEPARATOR.substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2).DIRECTORY_SEPARATOR.$filename.".json";
92 92
             /** @var \PSFS\base\Cache $cacheService */
93 93
             $cacheService = Cache::getInstance();
94 94
             /** @var \PSFS\base\config\Config $configService */
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
                 $this->load($property, true, $class);
105 105
             }
106 106
             $this->setLoaded();
107
-        } else {
108
-            Logger::log(get_class($this) . ' already loaded', LOG_INFO);
107
+        }else {
108
+            Logger::log(get_class($this).' already loaded', LOG_INFO);
109 109
         }
110 110
     }
111 111
 }
Please login to merge, or discard this patch.
src/base/config/Config.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     protected function init()
76 76
     {
77
-        if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE)) {
77
+        if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE)) {
78 78
             $this->loadConfigData();
79 79
         }
80 80
         return $this;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
             $final_data = array_filter($final_data, function($key, $value) {
183 183
                 return in_array($key, Config::$required) || !empty($value);
184 184
             }, ARRAY_FILTER_USE_BOTH);
185
-            $saved = (false !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT)));
185
+            $saved = (false !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT)));
186 186
             Config::getInstance()->loadConfigData();
187 187
             $saved = true;
188
-        } catch (ConfigException $e) {
188
+        }catch (ConfigException $e) {
189 189
             Logger::log($e->getMessage(), LOG_ERR);
190 190
         }
191 191
         return $saved;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      */
218 218
     public function loadConfigData()
219 219
     {
220
-        $this->config = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE), true) ?: [];
220
+        $this->config = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE), true) ?: [];
221 221
         $this->debug = (array_key_exists('debug', $this->config)) ? (bool)$this->config['debug'] : FALSE;
222 222
     }
223 223
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@
 block discarded – undo
196 196
     /**
197 197
      * Method that returns a config value
198 198
      * @param string $param
199
-     * @param mixed $defaultValue
199
+     * @param string $defaultValue
200 200
      *
201 201
      * @return mixed|null
202 202
      */
Please login to merge, or discard this patch.