Completed
Push — master ( 5cbf20...daf0f3 )
by Fran
08:08
created
src/base/Template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@
 block discarded – undo
307 307
             if ($file->isFile()) {
308 308
                 try {
309 309
                     $this->tpl->loadTemplate(str_replace($tplDir.'/', '', $file));
310
-                } catch (\Exception $e) {
310
+                }catch (\Exception $e) {
311 311
                     Logger::getInstance()->errorLog($e->getMessage());
312 312
                 }
313 313
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $dump = '';
198 198
         try {
199 199
             $dump = $this->tpl->render($tpl, $vars);
200
-        }catch (\Exception $e) {
200
+        } catch (\Exception $e) {
201 201
             echo $e->getMessage()."<pre>".$e->getTraceAsString()."</pre>";
202 202
         }
203 203
         return $dump;
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             unset($_SERVER["PHP_AUTH_USER"]);
395 395
             unset($_SERVER["PHP_AUTH_PW"]);
396 396
             header_remove("Authorization");
397
-        }else {
397
+        } else {
398 398
             header('Authorization:');
399 399
         }
400 400
     }
Please login to merge, or discard this patch.
src/base/config/Config.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         try {
141 141
             Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json", $final_data, Cache::JSON, true);
142 142
             $saved = true;
143
-        }catch (ConfigException $e) {
143
+        } catch (ConfigException $e) {
144 144
             Logger::getInstance()->errorLog($e->getMessage());
145 145
         }
146 146
         return $saved;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             if (@mkdir($dir, 0775, true) === false) {
183 183
                 throw new \Exception(_('Can\'t create directory ').$dir);
184 184
             }
185
-        }catch (\Exception $e) {
185
+        } catch (\Exception $e) {
186 186
             if (!file_exists(dirname($dir))) {
187 187
                 throw new ConfigException($e->getMessage().$dir);
188 188
             }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json"))
47 47
         {
48 48
             $this->loadConfigData();
49
-        } else {
49
+        }else {
50 50
             $this->debug = true;
51 51
         }
52 52
         return $this;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) {
198 198
                 try {
199 199
                     @shell_exec("rm -rf ".WEB_DIR.DIRECTORY_SEPARATOR.$dir);
200
-                } catch(\Exception $e) {
200
+                }catch (\Exception $e) {
201 201
                     Logger::getInstance()->errorLog($e->getMessage());
202 202
                 }
203 203
             }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function loadConfigData()
211 211
     {
212
-        $this->config = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "config.json", Cache::JSON, TRUE) ?: array();
212
+        $this->config = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json", Cache::JSON, TRUE) ?: array();
213 213
         $this->debug = (array_key_exists('debug', $this->config)) ? (bool)$this->config['debug'] : FALSE;
214 214
     }
215 215
 }
Please login to merge, or discard this patch.
src/base/dto/Dto.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
             try {
21 21
                 $reflectionClass = new \ReflectionClass($this);
22 22
                 $properties = $reflectionClass->getProperties();
23
-                if(count($properties) > 0) {
23
+                if (count($properties) > 0) {
24 24
                     /** @var \ReflectionProperty $property */
25
-                    foreach($properties as $property) {
25
+                    foreach ($properties as $property) {
26 26
                         $dto[$property->getName()] = $property->getValue($this);
27 27
                     }
28 28
                 }
29
-            } catch(\Exception $e) {
29
+            }catch (\Exception $e) {
30 30
                 Logger::getInstance(get_class($this))->errorLog($e->getMessage());
31 31
             }
32 32
             return $dto;
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
          */
48 48
         public function fromArray(array $object = array())
49 49
         {
50
-            if(count($object) > 0) {
51
-                foreach($object as $key => $value) {
52
-                    if(property_exists($this, $key)) {
50
+            if (count($object) > 0) {
51
+                foreach ($object as $key => $value) {
52
+                    if (property_exists($this, $key)) {
53 53
                         $this->$key = $value;
54 54
                     }
55 55
                 }
Please login to merge, or discard this patch.
src/base/dto/Order.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
         {
32 32
             $order = array();
33 33
             if (count($order) > 0) {
34
-                foreach($this->fields as $field => $direction) {
35
-                    if(strtolower($fieldToRemove) === strtolower($field)) {
34
+                foreach ($this->fields as $field => $direction) {
35
+                    if (strtolower($fieldToRemove) === strtolower($field)) {
36 36
                         continue;
37 37
                     }
38 38
                     $order[$field] = $direction;
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
          */
61 61
         public static function parseDirection($direction = Order::ASC)
62 62
         {
63
-            if(preg_match('/^asc$/i', $direction)) {
63
+            if (preg_match('/^asc$/i', $direction)) {
64 64
                 return Order::ASC;
65
-            } else {
65
+            }else {
66 66
                 return Order::DESC;
67 67
             }
68 68
         }
Please login to merge, or discard this patch.
src/base/extension/AssetsParser.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             }
158 158
         }
159 159
         if (!$this->debug && !file_exists($base.$this->hash.".js")) {
160
-            $this->storeContents($base.$this->hash.".js", $data);//Minifier::minify($data));
160
+            $this->storeContents($base.$this->hash.".js", $data); //Minifier::minify($data));
161 161
         }
162 162
         return $this;
163 163
     }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             foreach ($this->compiled_files as $file) {
197 197
                 echo "\t\t<script type='text/javascript' src='{$file}'></script>\n";
198 198
             }
199
-        } else {
199
+        }else {
200 200
             echo "\t\t<script type='text/javascript' src='/js/".$this->hash.".js'></script>\n";
201 201
         }
202 202
     }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             foreach ($this->compiled_files as $file) {
211 211
                 echo "\t\t<link href='{$file}' rel='stylesheet' media='screen, print'>";
212 212
             }
213
-        } else {
213
+        }else {
214 214
             echo "\t\t<link href='/css/".$this->hash.".css' rel='stylesheet' media='screen, print'>";
215 215
         }
216 216
     }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                     $this->log->infoLog("$orig copiado a $dest");
236 236
                 }
237 237
             }
238
-        } catch (\Exception $e) {
238
+        }catch (\Exception $e) {
239 239
             $this->log->errorLog($e->getMessage());
240 240
         }
241 241
     }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             if ($this->debug) {
265 265
                 $data = file_get_contents($file);
266 266
                 $this->storeContents($base.$file_path, $data);
267
-            } else {
267
+            }else {
268 268
                 $data .= file_get_contents($file);
269 269
             }
270 270
             $this->compiled_files[] = "/css/".$file_path;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -303,7 +303,7 @@
 block discarded – undo
303 303
         $js = file_get_contents($file);
304 304
         try {
305 305
             $data .= ";\n".$js;
306
-        }catch (\Exception $e) {
306
+        } catch (\Exception $e) {
307 307
             throw new ConfigException($e->getMessage());
308 308
         }
309 309
         return $data;
Please login to merge, or discard this patch.
src/base/extension/AssetsTokenParser.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
         $tmp = array();
136 136
         if (NULL === $node) {
137 137
             $node = $value;
138
-        }else {
138
+        } else {
139 139
             $tmp = $this->getTmpAttribute($node);
140 140
         }
141 141
         $tmp[] = $value->getAttribute("value");
Please login to merge, or discard this patch.
src/base/types/SingletonTrait.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
             $class = get_called_class();
23 23
             if (!array_key_exists($class, self::$instance) || !self::$instance[$class] instanceof $class) {
24 24
                 self::$instance[$class] = new $class(func_get_args());
25
-                if (method_exists(self::$instance[$class], "init")) self::$instance[$class]->init();
25
+                if (method_exists(self::$instance[$class], "init")) {
26
+                    self::$instance[$class]->init();
27
+                }
26 28
             }
27 29
             return self::$instance[$class];
28 30
         }
Please login to merge, or discard this patch.
src/bootstrap.php 1 patch
Braces   +29 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,19 +1,37 @@
 block discarded – undo
1 1
 <?php
2 2
     use Symfony\Component\Finder\Finder;
3 3
 
4
-    if (!defined('SOURCE_DIR'))define('SOURCE_DIR', __DIR__);
4
+    if (!defined('SOURCE_DIR')) {
5
+        define('SOURCE_DIR', __DIR__);
6
+    }
5 7
     if (preg_match('/vendor/', SOURCE_DIR))
6 8
     {
7
-        if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');
8
-        if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src');
9
-    }else {
10
-        if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..');
11
-        if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules');
12
-    }
13
-    if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
14
-    if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache');
15
-    if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config');
16
-    if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html');
9
+        if (!defined('BASE_DIR')) {
10
+            define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');
11
+        }
12
+        if (!defined('CORE_DIR')) {
13
+            define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src');
14
+        }
15
+    } else {
16
+        if (!defined('BASE_DIR')) {
17
+            define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..');
18
+        }
19
+        if (!defined('CORE_DIR')) {
20
+            define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules');
21
+        }
22
+    }
23
+    if (!defined('LOG_DIR')) {
24
+        define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
25
+    }
26
+    if (!defined('CACHE_DIR')) {
27
+        define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache');
28
+    }
29
+    if (!defined('CONFIG_DIR')) {
30
+        define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config');
31
+    }
32
+    if (!defined('WEB_DIR')) {
33
+        define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html');
34
+    }
17 35
 
18 36
     //Cargamos en memoria la función de desarrollo PRE
19 37
     if (!function_exists('pre')) {
Please login to merge, or discard this patch.
src/command/CreateDocumentRoot.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
     use Symfony\Component\Console\Input\InputInterface;
7 7
     use Symfony\Component\Console\Output\OutputInterface;
8 8
 
9
-    if (!isset($console)) $console = new Application();
9
+    if (!isset($console)) {
10
+        $console = new Application();
11
+    }
10 12
     $console
11 13
         ->register('psfs:create:root')
12 14
         ->setDefinition(array(
@@ -15,13 +17,17 @@  discard block
 block discarded – undo
15 17
         ->setDescription('Comando de creación del Document Root del projecto')
16 18
         ->setCode(function(InputInterface $input, OutputInterface $output) {
17 19
             $path = $input->getArgument('path');
18
-            if (empty($path)) $path = BASE_DIR.DIRECTORY_SEPARATOR.'html';
20
+            if (empty($path)) {
21
+                $path = BASE_DIR.DIRECTORY_SEPARATOR.'html';
22
+            }
19 23
             \PSFS\base\config\Config::createDir($path);
20 24
             $paths = array("js", "css", "img", "media", "font");
21 25
             foreach ($paths as $htmlPath) {
22 26
                 \PSFS\base\config\Config::createDir($path.DIRECTORY_SEPARATOR.$htmlPath);
23 27
             }
24
-            if (!file_exists(SOURCE_DIR.DIRECTORY_SEPARATOR.'html.tar.gz')) throw new \PSFS\base\exception\ConfigException("No existe el fichero del DocumentRoot");
28
+            if (!file_exists(SOURCE_DIR.DIRECTORY_SEPARATOR.'html.tar.gz')) {
29
+                throw new \PSFS\base\exception\ConfigException("No existe el fichero del DocumentRoot");
30
+            }
25 31
             $tar = new \Archive_Tar(realpath(SOURCE_DIR.DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR."html.tar.gz", true);
26 32
             $tar->extract(realpath($path));
27 33
             $output->writeln("Document root generado en ".$path);
Please login to merge, or discard this patch.