Completed
Branch master (d57d41)
by Vermeulen
03:02
created
src/classes/Kernel.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $key = array_search($observer, $this->observers, true);
63 63
         
64
-        if($key !== false)
64
+        if ($key !== false)
65 65
         {
66 66
             unset($this->observers[$key]);
67 67
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $key = array_search($observer, $this->observers, true);
78 78
         
79
-        if($key)
79
+        if ($key)
80 80
         {
81 81
             unset($this->observers[$key]);
82 82
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function notifyObserver($action)
91 91
     {
92
-        foreach($this->observers as $observer)
92
+        foreach ($this->observers as $observer)
93 93
         {
94 94
             //Appel la méthode update de l'observateur
95 95
             $observer->updateWithAction($this, $action);
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function notify()
118 118
     {
119
-        if(!is_null($this->notify_action))
119
+        if (!is_null($this->notify_action))
120 120
         {
121 121
             $this->notifyObserver($this->notify_action);
122 122
         }
123 123
         else
124 124
         {
125
-            foreach($this->observers as $observer)
125
+            foreach ($this->observers as $observer)
126 126
             {
127 127
                 //Appel la méthode update de l'observateur
128 128
                 $observer->update($this);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $this->debug = $debug;
142 142
         
143
-        if($debug) //Affiche toutes les erreurs de php
143
+        if ($debug) //Affiche toutes les erreurs de php
144 144
         {
145 145
             error_reporting(E_ALL);
146 146
             ini_set('display_errors', 'On');
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -119,8 +119,7 @@  discard block
 block discarded – undo
119 119
         if(!is_null($this->notify_action))
120 120
         {
121 121
             $this->notifyObserver($this->notify_action);
122
-        }
123
-        else
122
+        } else
124 123
         {
125 124
             foreach($this->observers as $observer)
126 125
             {
@@ -140,13 +139,14 @@  discard block
 block discarded – undo
140 139
     {
141 140
         $this->debug = $debug;
142 141
         
143
-        if($debug) //Affiche toutes les erreurs de php
142
+        if($debug) {
143
+            //Affiche toutes les erreurs de php
144 144
         {
145 145
             error_reporting(E_ALL);
146
+        }
146 147
             ini_set('display_errors', 'On');
147 148
             ini_set('html_errors', true);
148
-        }
149
-        else //Affiche aucune erreur (prod)
149
+        } else //Affiche aucune erreur (prod)
150 150
         {
151 151
             error_reporting(0);
152 152
         }
Please login to merge, or discard this patch.
src/classes/Modules.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
         $jsonInfo = file_get_contents($filePath);
60 60
         $modInfo  = json_decode($jsonInfo, true);
61 61
         
62
-        if(!isset($modInfo['name']))
62
+        if (!isset($modInfo['name']))
63 63
         {
64 64
             throw new \Exception('Le nom du module n\'est pas déclaré (path: '.$path.').');
65 65
         }
66 66
         
67
-        if(isset($modInfo['params']) && !is_array($modInfo['params']))
67
+        if (isset($modInfo['params']) && !is_array($modInfo['params']))
68 68
         {
69 69
             throw new \Exception('Les paramètres du module '.$name.' n\'est pas au bon format.');
70 70
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * 
91 91
      * @throws \Exception Erreur sur la déclaration des options
92 92
      */ 
93
-    public function newMod($name, $params=array())
93
+    public function newMod($name, $params = array())
94 94
     {
95 95
         $this->initParameters($params, 'runFile', 'inclus.php');
96 96
         $this->initMod($name, $params);
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
      * 
111 111
      * @throws \Exception Erreur sur la déclaration des options
112 112
      */ 
113
-    protected function initMod($name, $params=array())
113
+    protected function initMod($name, $params = array())
114 114
     {
115
-        if($this->exists($name))
115
+        if ($this->exists($name))
116 116
         {
117 117
             throw new \Exception('Le module '.$name.' existe déjà.');
118 118
         }
119 119
         
120
-        if(!is_array($params))
120
+        if (!is_array($params))
121 121
         {
122 122
             throw new \Exception('Les options du module '.$name.' doivent être déclarer sous la forme d\'un array.');
123 123
         }
@@ -145,19 +145,19 @@  discard block
 block discarded – undo
145 145
      */
146 146
     protected function initParameters(&$params, $key, $default)
147 147
     {
148
-        if(!is_array($params)) {return;}
148
+        if (!is_array($params)) {return; }
149 149
         
150
-        if(!isset($params[$key]))
150
+        if (!isset($params[$key]))
151 151
         {
152 152
             $params[$key] = $default;
153 153
         }
154 154
         
155
-        if(is_int($default))
155
+        if (is_int($default))
156 156
         {
157 157
             $params[$key] = (int) $params[$key];
158 158
         }
159 159
         
160
-        if(is_array($default) && !is_array($params[$key]))
160
+        if (is_array($default) && !is_array($params[$key]))
161 161
         {
162 162
             $params[$key] = array($params[$key]);
163 163
         }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function loaded($name)
202 202
     {
203
-        if(!$this->exists($name))
203
+        if (!$this->exists($name))
204 204
         {
205 205
             throw new \Exception('Module '.$name.' not exists.');
206 206
         }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      */
219 219
     public function addPath($name, $path)
220 220
     {
221
-        if(!$this->exists($name)) {throw new \Exception('Le module '.$name.' n\'existe pas.');}
221
+        if (!$this->exists($name)) {throw new \Exception('Le module '.$name.' n\'existe pas.'); }
222 222
         $this->modList[$name]['path'] = $path;
223 223
     }
224 224
     
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
         $arrayToLoad = array();
237 237
         $toLoad = array();
238 238
         
239
-        foreach($this->modList as &$mod)
239
+        foreach ($this->modList as &$mod)
240 240
         {
241
-            if($mod['time'] == $timeToLoad)
241
+            if ($mod['time'] == $timeToLoad)
242 242
             {
243 243
                 $toLoad[] = $mod;
244 244
             }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         
248 248
         uasort($toLoad, array($this, 'sortPriority'));
249 249
         
250
-        foreach($toLoad as &$mod)
250
+        foreach ($toLoad as &$mod)
251 251
         {
252 252
             //Une exception est levé par modToLoad s'il y a une problème;
253 253
             $this->modToLoad($mod, $arrayToLoad);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         $prio1 = $mod1['priority'];
270 270
         $prio2 = $mod2['priority'];
271 271
         
272
-        if($prio1 === $prio2)
272
+        if ($prio1 === $prio2)
273 273
         {
274 274
             return 0;
275 275
         }
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
      * 
288 288
      * @return bool Si le module peut être chargé ou non.
289 289
      */
290
-    protected function modToLoad(&$mod, &$arrayToLoad, $waitToLoad=array())
290
+    protected function modToLoad(&$mod, &$arrayToLoad, $waitToLoad = array())
291 291
     {
292
-        if(in_array($mod['name'], $arrayToLoad) || isset($waitToLoad[$mod['name']]))
292
+        if (in_array($mod['name'], $arrayToLoad) || isset($waitToLoad[$mod['name']]))
293 293
         {
294 294
             return true;
295 295
         }
@@ -299,20 +299,20 @@  discard block
 block discarded – undo
299 299
         $require = $mod['require'];
300 300
         $load    = true;
301 301
         
302
-        foreach($require as $modRequire)
302
+        foreach ($require as $modRequire)
303 303
         {
304
-            if(!array_key_exists($modRequire, $this->modList))
304
+            if (!array_key_exists($modRequire, $this->modList))
305 305
             {
306 306
                 throw new \Exception('La dépendance '.$modRequire.' du module '.$mod['name'].' n\'a pas été trouvé.');
307 307
             }
308 308
             
309
-            if(!$this->isLoad($modRequire))
309
+            if (!$this->isLoad($modRequire))
310 310
             {
311 311
                 $load = $this->modToLoad($this->modList[$modRequire], $arrayToLoad, $waitToLoad);
312 312
             }
313 313
         }
314 314
         
315
-        if($load)
315
+        if ($load)
316 316
         {
317 317
             $arrayToLoad[] = $mod['name'];
318 318
             unset($waitToLoad[$mod['name']]);
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
      * 
329 329
      * @return array Liste des modules non chargé
330 330
      */
331
-    public function listNotLoad($regen=false)
331
+    public function listNotLoad($regen = false)
332 332
     {
333
-        if($regen === true || is_null($this->notLoad))
333
+        if ($regen === true || is_null($this->notLoad))
334 334
         {
335 335
             $this->notLoad = array_diff($this->modList, $this->modLoad);
336 336
         }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
     {
348 348
         $diff = $this->listNotLoad();
349 349
         
350
-        if(count($diff) > 0) {return true;}
350
+        if (count($diff) > 0) {return true; }
351 351
         return false;
352 352
     }
353 353
     
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      */
363 363
     public function getModuleInfos($name)
364 364
     {
365
-        if(!$this->exists($name)) {throw new \Exception('Le module '.$name.' n\'existe pas.');}
365
+        if (!$this->exists($name)) {throw new \Exception('Le module '.$name.' n\'existe pas.'); }
366 366
         return $this->modList[$name];
367 367
     }
368 368
     
Please login to merge, or discard this patch.
src/classes/Form.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * 
31 31
      * @param string $idForm L'id du formulaire
32 32
      */
33
-    public function __construct($idForm=null)
33
+    public function __construct($idForm = null)
34 34
     {
35 35
         $this->_kernel = getKernel();
36 36
         
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function tokenCreate()
58 58
     {
59
-        if(is_null($this->idForm)) {throw new Exception('Form name is undefined.');}
59
+        if (is_null($this->idForm)) {throw new Exception('Form name is undefined.'); }
60 60
         
61 61
         $Id = uniqid(rand(), true);
62 62
         $date = new Date();
@@ -79,20 +79,20 @@  discard block
 block discarded – undo
79 79
     {
80 80
         global $_SESSION, $_POST;
81 81
         
82
-        if(isset($_SESSION['token']) && is_array($_SESSION['token']))
82
+        if (isset($_SESSION['token']) && is_array($_SESSION['token']))
83 83
         {
84
-            if(isset($_SESSION['token'][$this->idForm]) && is_array($_SESSION['token'][$this->idForm]))
84
+            if (isset($_SESSION['token'][$this->idForm]) && is_array($_SESSION['token'][$this->idForm]))
85 85
             {
86 86
                 $token = $_SESSION['token'][$this->idForm]['token'];
87 87
                 $date_create = $_SESSION['token'][$this->idForm]['date'];
88 88
                 $date_createDT = new Date($date_create);
89 89
                 
90
-                if(isset($_POST['token']) && $_POST['token'] == $token)
90
+                if (isset($_POST['token']) && $_POST['token'] == $token)
91 91
                 {
92 92
                     $date_limit = new Date();
93 93
                     $date_limit->modify('-15 minute');
94 94
                     
95
-                    if($date_createDT >= $date_limit)
95
+                    if ($date_createDT >= $date_limit)
96 96
                     {
97 97
                         unset($_SESSION['token'][$this->idForm]);
98 98
                         return true;
Please login to merge, or discard this patch.
src/classes/CreateClasse.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -90,23 +90,23 @@  discard block
 block discarded – undo
90 90
      * @param string $nom     Le nom de la futur classe
91 91
      * @param array  $options Les options de la classe
92 92
      */
93
-    public function __construct($nom, $options=array())
93
+    public function __construct($nom, $options = array())
94 94
     {
95 95
         $this->_kernel = getKernel();
96 96
         
97 97
         $this->nom = $nom;
98 98
         
99
-        if(isset($options['indente']))
99
+        if (isset($options['indente']))
100 100
         {
101 101
             $this->indente = $options['indente'];
102 102
         }
103 103
         
104
-        if(isset($options['extends']))
104
+        if (isset($options['extends']))
105 105
         {
106 106
             $this->extends = $options['extends'];
107 107
         }
108 108
         
109
-        if(isset($options['implements']))
109
+        if (isset($options['implements']))
110 110
         {
111 111
             $this->implements = $options['implements'];
112 112
         }
@@ -138,21 +138,21 @@  discard block
 block discarded – undo
138 138
      * 
139 139
      * @return bool True si réussi, False si existe déjà.
140 140
      */
141
-    public function createAttribut($nom, $opt=array())
141
+    public function createAttribut($nom, $opt = array())
142 142
     {
143
-        if(in_array($nom, $this->attributs)) {return false;}
143
+        if (in_array($nom, $this->attributs)) {return false; }
144 144
         
145
-        if(!isset($opt['porter']))
145
+        if (!isset($opt['porter']))
146 146
         {
147 147
             $opt['porter'] = 'protected';
148 148
         }
149 149
         
150
-        if(!isset($opt['get']))
150
+        if (!isset($opt['get']))
151 151
         {
152 152
             $opt['get'] = 1;
153 153
         }
154 154
         
155
-        if(!isset($opt['set']))
155
+        if (!isset($opt['set']))
156 156
         {
157 157
             $opt['set'] = 1;
158 158
         }
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
         $this->attributs_porter[] = $opt['porter'];
162 162
         $this->attributs_option[] = $opt;
163 163
         
164
-        if($opt['get'] == 1)
164
+        if ($opt['get'] == 1)
165 165
         {
166 166
             $this->get[] = $nom;
167 167
         }
168 168
         
169
-        if($opt['set'] == 1)
169
+        if ($opt['set'] == 1)
170 170
         {
171 171
             $this->set[] = $nom;
172 172
         }
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
      * 
185 185
      * @return bool
186 186
      */
187
-    public function createMethode($nom, $porter='protected')
187
+    public function createMethode($nom, $porter = 'protected')
188 188
     {
189
-        if(in_array($nom, $this->methode)) {return false;}
189
+        if (in_array($nom, $this->methode)) {return false; }
190 190
         
191 191
         $this->methode[] = $nom;
192 192
         $this->methode_porter[] = $porter;
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
         $javadoc = $code = '';
205 205
         $default = isset($this->attributs_option[$key]['default']) ? true : false;
206 206
         
207
-        $default_string =  false;
208
-        if(
207
+        $default_string = false;
208
+        if (
209 209
             isset($this->attributs_option[$key]['default_string']) && 
210 210
             $this->attributs_option[$key]['default_string'] == true
211 211
         )
212 212
         {
213
-            $default_string =  true;
213
+            $default_string = true;
214 214
         }
215 215
         
216 216
         
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
         $code .= $this->attributs_porter[$key].' $'.$this->attributs[$key];
225 225
         
226 226
         //S'il y a une valeur par défaut
227
-        if($default === true)
227
+        if ($default === true)
228 228
         {
229 229
             $javadoc .= ' Par défaut à ';
230 230
             $code .= ' = ';
231 231
             
232 232
             //Si la valeur par défaut est dite un string. On ajoute des '
233
-            if($default_string === true)
233
+            if ($default_string === true)
234 234
             {
235 235
                 $javadoc .= '\'';
236 236
                 $code .= '\'';
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
             $code .= $this->attributs_option[$key]['default'];
241 241
             
242 242
             //Si la valeur par défaut est dite un string. On ajoute des '
243
-            if($default_string === true)
243
+            if ($default_string === true)
244 244
             {
245 245
                 $javadoc .= '\'';
246 246
                 $code .= '\'';
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     protected function genereSet($key)
282 282
     {
283 283
         $nom = $this->set[$key];
284
-        if(!in_array('set_'.$nom, $this->methode_create))
284
+        if (!in_array('set_'.$nom, $this->methode_create))
285 285
         {
286 286
             $this->file .= $this->indente."/**\n";
287 287
             $this->file .= $this->indente.' * Accesseur set vers '.$nom."\n".$this->indente." *\n";
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      */
306 306
     protected function genereMethode($key)
307 307
     {
308
-        if(in_array($this->methode[$key], $this->methode_create)) {return;}
308
+        if (in_array($this->methode[$key], $this->methode_create)) {return; }
309 309
         
310 310
         $this->file .= $this->indente."/**\n";
311 311
         $this->file .= $this->indente." * Description de ma méthode.\n";
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
         $this->file .= "/**\n * La description de ma classe\n * @package MonProjet\n */\n";
328 328
         
329 329
         $this->file .= 'class '.$this->nom;
330
-        if(!empty($this->extends))
330
+        if (!empty($this->extends))
331 331
         {
332 332
             $this->file .= ' extends '.$this->extends;
333 333
         }
334 334
         
335
-        if(count($this->implements) > 0)
335
+        if (count($this->implements) > 0)
336 336
         {
337 337
             $this->file .= ' implements ';
338
-            foreach($this->implements as $key => $implement)
338
+            foreach ($this->implements as $key => $implement)
339 339
             {
340 340
                 $this->file .= ($key > 0) ? ', ' : '';
341 341
                 $this->file .= $implement;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         $this->file .= "\n{\n";
345 345
         
346 346
         //Création des attributs
347
-        foreach($this->attributs as $key => $attr)
347
+        foreach ($this->attributs as $key => $attr)
348 348
         {
349 349
             $this->genereAttribut($key);
350 350
         }
@@ -357,21 +357,21 @@  discard block
 block discarded – undo
357 357
         $this->file .= $this->indente."public function __construct() {}\n\n";
358 358
         
359 359
         //Les gets
360
-        foreach($this->get as $key => $nom)
360
+        foreach ($this->get as $key => $nom)
361 361
         {
362 362
             $this->genereGet($key);
363
-            if(in_array($nom, $this->set))
363
+            if (in_array($nom, $this->set))
364 364
             {
365 365
                 $this->genereSet($key);
366 366
             }
367 367
         }
368 368
         
369
-        foreach($this->set as $key => $nom)
369
+        foreach ($this->set as $key => $nom)
370 370
         {
371 371
             $this->genereSet($key);
372 372
         }
373 373
         
374
-        foreach($this->methode as $key => $nom)
374
+        foreach ($this->methode as $key => $nom)
375 375
         {
376 376
             $this->genereMethode($key);
377 377
         }
Please login to merge, or discard this patch.
src/fonctions/global.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
       (peut être génant sur un nom de variable dans le cas par exemple de $_POST['coucou'] ou $_POST['cou_cou'] pour l'exemple au-dessus)
35 35
      */
36 36
 
37
-    if(is_array($string)) //Au cas où la valeur à vérifier soit un array (peut arriver avec les POST)
37
+    if (is_array($string)) //Au cas où la valeur à vérifier soit un array (peut arriver avec les POST)
38 38
     {
39
-        foreach($string as $key => $val)
39
+        foreach ($string as $key => $val)
40 40
         {
41 41
             //Dans le cas où après si $key est modifié, alors la valeur pour 
42 42
             //la clé non sécurisé existerais toujours et la sécurisation 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 
56 56
     // On regarde si le type de string est un nombre entier (int)
57
-    if(ctype_digit($string))
57
+    if (ctype_digit($string))
58 58
     {
59 59
         $string = intval($string);
60 60
         return $string;
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
     //commenté car problème de notice si php < 5.4
68 68
     //if(defined(ENT_HTML401)) {$optHtmlentities .= ' | '.ENT_HTML401;} //à partir de php5.4
69 69
 
70
-    if($html === false)
70
+    if ($html === false)
71 71
     {
72 72
         $string = htmlentities($string, $optHtmlentities, 'UTF-8');
73 73
     }
74 74
 
75
-    if(function_exists('DB_protect'))
75
+    if (function_exists('DB_protect'))
76 76
     {
77 77
         $string = DB_protect($string);
78 78
     }
79 79
 
80
-    if($null_cslashe === false)
80
+    if ($null_cslashe === false)
81 81
     {
82 82
         $string = addcslashes($string, '%_');
83 83
     }
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function post($key, $default = null, $html = false)
133 133
 {
134
-    if(!isset($_POST[$key]))
134
+    if (!isset($_POST[$key]))
135 135
     {
136 136
         return $default;
137 137
     }
138 138
 
139 139
     $post = $_POST[$key];
140 140
 
141
-    if(is_string($post))
141
+    if (is_string($post))
142 142
     {
143 143
         $post = trim($post);
144 144
     }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function get($key, $default = null)
158 158
 {
159
-    if(!isset($_GET[$key]))
159
+    if (!isset($_GET[$key]))
160 160
     {
161 161
         return $default;
162 162
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
  */
185 185
 function ErrorView($num, $cleanCache = true)
186 186
 {
187
-    if($cleanCache)
187
+    if ($cleanCache)
188 188
     {
189 189
         ob_clean(); //On efface tout ce qui a pu être mis dans le buffer pour l'affichage
190 190
     }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     global $request, $path;
193 193
 
194 194
     //Envoi du status http
195
-    if(function_exists('http_response_code')) //php >= 5.4
195
+    if (function_exists('http_response_code')) //php >= 5.4
196 196
     {
197 197
         http_response_code($num);
198 198
     }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         header(':', true, $num);
202 202
     }
203 203
 
204
-    if(file_exists(path_controllers.'erreurs/'.$num.'.php'))
204
+    if (file_exists(path_controllers.'erreurs/'.$num.'.php'))
205 205
     {
206 206
         require_once(path_controllers.'erreurs/'.$num.'.php');
207 207
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
  */
228 228
 function logfile($file, $txt, $date = true)
229 229
 {
230
-    if($date === true)
230
+    if ($date === true)
231 231
     {
232 232
         $date    = new \BFW\Date();
233 233
         $dateTxt = $date->getJour()
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     {
245 245
         file_put_contents($file, rtrim($txt)."\n", FILE_APPEND);
246 246
     }
247
-    catch(\Exception $e)
247
+    catch (\Exception $e)
248 248
     {
249 249
         echo '<br/>Impossible d\'écrire dans le fichier : '.$file.'<br/>';
250 250
     }
@@ -259,39 +259,39 @@  discard block
 block discarded – undo
259 259
  */
260 260
 function verifTypeData($vars)
261 261
 {
262
-    if(!is_array($vars))
262
+    if (!is_array($vars))
263 263
     {
264 264
         return false;
265 265
     }
266 266
 
267
-    foreach($vars as $var)
267
+    foreach ($vars as $var)
268 268
     {
269
-        if(!is_array($var))
269
+        if (!is_array($var))
270 270
         {
271 271
             return false;
272 272
         }
273 273
 
274
-        if(!(!empty($var['type']) && isset($var['data'])))
274
+        if (!(!empty($var['type']) && isset($var['data'])))
275 275
         {
276 276
             return false;
277 277
         }
278 278
 
279
-        if($var['type'] == 'int')
279
+        if ($var['type'] == 'int')
280 280
         {
281 281
             $var['type'] = 'integer';
282 282
         }
283 283
 
284
-        if($var['type'] == 'float')
284
+        if ($var['type'] == 'float')
285 285
         {
286 286
             $var['type'] = 'double';
287 287
         }
288 288
 
289
-        if(!is_string($var['type']))
289
+        if (!is_string($var['type']))
290 290
         {
291 291
             return false;
292 292
         }
293 293
 
294
-        if(gettype($var['data']) != $var['type'])
294
+        if (gettype($var['data']) != $var['type'])
295 295
         {
296 296
             return false;
297 297
         }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 {
310 310
     global $BFWKernel;
311 311
 
312
-    if(!(isset($BFWKernel) && is_object($BFWKernel) && get_class($BFWKernel) == 'BFW\Kernel'))
312
+    if (!(isset($BFWKernel) && is_object($BFWKernel) && get_class($BFWKernel) == 'BFW\Kernel'))
313 313
     {
314 314
         $BFWKernel = new \BFW\Kernel;
315 315
     }
@@ -326,14 +326,14 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function is_session_started()
328 328
 {
329
-    if(php_sapi_name() === 'cli')
329
+    if (php_sapi_name() === 'cli')
330 330
     {
331 331
         return false;
332 332
     }
333 333
 
334
-    if(PHP_VERSION_ID >= 50400) //PHP >= 5.4.0
334
+    if (PHP_VERSION_ID >= 50400) //PHP >= 5.4.0
335 335
     {
336
-        if(session_status() === PHP_SESSION_ACTIVE)
336
+        if (session_status() === PHP_SESSION_ACTIVE)
337 337
         {
338 338
             return true;
339 339
         }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         return false;
342 342
     }
343 343
 
344
-    if(session_id() !== '')
344
+    if (session_id() !== '')
345 345
     {
346 346
         return true;
347 347
     }
Please login to merge, or discard this patch.
Braces   +12 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
       (peut être génant sur un nom de variable dans le cas par exemple de $_POST['coucou'] ou $_POST['cou_cou'] pour l'exemple au-dessus)
35 35
      */
36 36
 
37
-    if(is_array($string)) //Au cas où la valeur à vérifier soit un array (peut arriver avec les POST)
37
+    if(is_array($string)) {
38
+        //Au cas où la valeur à vérifier soit un array (peut arriver avec les POST)
38 39
     {
39 40
         foreach($string as $key => $val)
40 41
         {
@@ -42,6 +43,7 @@  discard block
 block discarded – undo
42 43
             //la clé non sécurisé existerais toujours et la sécurisation 
43 44
             //ne servirais à rien.
44 45
             unset($string[$key]);
46
+    }
45 47
 
46 48
             $key = secure($key, true, $null_cslashe);
47 49
             $val = secure($val, $html, $null_cslashe);
@@ -192,11 +194,12 @@  discard block
 block discarded – undo
192 194
     global $request, $path;
193 195
 
194 196
     //Envoi du status http
195
-    if(function_exists('http_response_code')) //php >= 5.4
197
+    if(function_exists('http_response_code')) {
198
+        //php >= 5.4
196 199
     {
197 200
         http_response_code($num);
198 201
     }
199
-    else //php < 5.4
202
+    } else //php < 5.4
200 203
     {
201 204
         header(':', true, $num);
202 205
     }
@@ -204,12 +207,10 @@  discard block
 block discarded – undo
204 207
     if(file_exists(path_controllers.'erreurs/'.$num.'.php'))
205 208
     {
206 209
         require_once(path_controllers.'erreurs/'.$num.'.php');
207
-    }
208
-    elseif (file_exists(path_controllers.'erreurs.php')) 
210
+    } elseif (file_exists(path_controllers.'erreurs.php')) 
209 211
     {
210 212
         require_once(path_controllers.'erreurs.php');
211
-    }
212
-    else
213
+    } else
213 214
     {
214 215
         echo 'Erreur '.$num;
215 216
     }
@@ -243,8 +244,7 @@  discard block
 block discarded – undo
243 244
     try
244 245
     {
245 246
         file_put_contents($file, rtrim($txt)."\n", FILE_APPEND);
246
-    }
247
-    catch(\Exception $e)
247
+    } catch(\Exception $e)
248 248
     {
249 249
         echo '<br/>Impossible d\'écrire dans le fichier : '.$file.'<br/>';
250 250
     }
@@ -331,11 +331,13 @@  discard block
 block discarded – undo
331 331
         return false;
332 332
     }
333 333
 
334
-    if(PHP_VERSION_ID >= 50400) //PHP >= 5.4.0
334
+    if(PHP_VERSION_ID >= 50400) {
335
+        //PHP >= 5.4.0
335 336
     {
336 337
         if(session_status() === PHP_SESSION_ACTIVE)
337 338
         {
338 339
             return true;
340
+    }
339 341
         }
340 342
 
341 343
         return false;
Please login to merge, or discard this patch.
src/bootstrap.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
  * @package bfw
11 11
  */
12 12
 
13
-if(!isset($rootPath))
13
+if (!isset($rootPath))
14 14
 {
15
-    if(!isset($myVendorName))
15
+    if (!isset($myVendorName))
16 16
     {
17 17
         $myVendorName = 'vendor';
18 18
     }
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 
29 29
 //Si multi-domain, recherche du domaine courant
30 30
 $base_url_config = $base_url;
31
-if(is_array($base_url))
31
+if (is_array($base_url))
32 32
 {
33
-    foreach($base_url as $url)
33
+    foreach ($base_url as $url)
34 34
     {
35
-        if(strpos($url, $_SERVER['SERVER_NAME']) !== false)
35
+        if (strpos($url, $_SERVER['SERVER_NAME']) !== false)
36 36
         {
37 37
             $base_url = $url;
38 38
             break;
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
     }
41 41
 
42 42
     //Si pas trouvé, on prend le premier domaine
43
-    if(is_array($base_url))
43
+    if (is_array($base_url))
44 44
     {
45 45
         $base_url = $base_url[0];
46 46
     }
47 47
 }
48 48
 
49
-if(substr($base_url, -1) == '/')
49
+if (substr($base_url, -1) == '/')
50 50
 {
51 51
     $base_url = substr($base_url, 0, -1);
52 52
 }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 $error     = null;
56 56
 $exBaseUrl = explode('/', $base_url);
57 57
 
58
-if(count($exBaseUrl) > 3)
58
+if (count($exBaseUrl) > 3)
59 59
 {
60 60
     unset($exBaseUrl[0], $exBaseUrl[1], $exBaseUrl[2]);
61 61
     $imBaseUrl  = '/'.implode('/', $exBaseUrl);
@@ -64,30 +64,30 @@  discard block
 block discarded – undo
64 64
     $request = substr($request, $lenBaseUrl);
65 65
 }
66 66
 
67
-if(!($request == '/index.php' || $request == '/'))
67
+if (!($request == '/index.php' || $request == '/'))
68 68
 {
69 69
     $ext = null;
70
-    if(strpos($request, '.') !== false)
70
+    if (strpos($request, '.') !== false)
71 71
     {
72 72
         $ext = substr($request, (strrpos($request, '.') + 1));
73 73
     }
74 74
 
75 75
     $file = $request;
76 76
 
77
-    if(substr($ext, 0, 3) != 'php' && !is_null($ext))
77
+    if (substr($ext, 0, 3) != 'php' && !is_null($ext))
78 78
     {
79 79
         $pathFile = '';
80 80
 
81
-        if(file_exists($rootPath.'web/'.$file)) //Un fichier mit dans /web
81
+        if (file_exists($rootPath.'web/'.$file)) //Un fichier mit dans /web
82 82
         {
83 83
             $pathFile = $rootPath.'web';
84 84
         }
85
-        elseif(strpos($request, '/modules/') !== false) //Un fichier non php mit dans un modules.
85
+        elseif (strpos($request, '/modules/') !== false) //Un fichier non php mit dans un modules.
86 86
         {
87 87
             $modulePos  = strpos($request, '/modules/') + 9;
88 88
             $moduleName = substr($request, $modulePos, (strpos($request, '/', $modulePos) - $modulePos));
89 89
 
90
-            if(!file_exists('modules/'.$moduleName.'/externe.php'))
90
+            if (!file_exists('modules/'.$moduleName.'/externe.php'))
91 91
             {
92 92
                 $error = 403;
93 93
             }
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
             $error = 404;
98 98
         }
99 99
 
100
-        if(is_null($error))
100
+        if (is_null($error))
101 101
         {
102
-            if($ext == 'css')
102
+            if ($ext == 'css')
103 103
             {
104 104
                 header('Content-type: text/css');
105 105
             }
106
-            elseif($ext == 'js')
106
+            elseif ($ext == 'js')
107 107
             {
108 108
                 header('Content-type: text/javascript');
109 109
             }
@@ -117,17 +117,17 @@  discard block
 block discarded – undo
117 117
             exit;
118 118
         }
119 119
     }
120
-    elseif(substr($ext, 0, 3) == 'php' && !is_null($ext))
120
+    elseif (substr($ext, 0, 3) == 'php' && !is_null($ext))
121 121
     {
122 122
         $modulePos  = strpos($request, '/modules/') + 9;
123 123
         $moduleName = substr($request, $modulePos, (strpos($request, '/', $modulePos) - $modulePos));
124 124
 
125
-        if(file_exists($rootPath.'modules/'.$moduleName.'/externe.php'))
125
+        if (file_exists($rootPath.'modules/'.$moduleName.'/externe.php'))
126 126
         {
127 127
             $afterModuleName = $modulePos + strlen($moduleName) + 1;
128 128
             require_once('modules/'.$moduleName.'/externe.php');
129 129
 
130
-            if(in_array($afterModuleName, $moduleExterneAuthorized))
130
+            if (in_array($afterModuleName, $moduleExterneAuthorized))
131 131
             {
132 132
                 require_once($rootPath.$request);
133 133
             }
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 
147 147
 require_once(__DIR__.'/BFW_init.php');
148 148
 
149
-if(!is_null($error))
149
+if (!is_null($error))
150 150
 {
151 151
     Errorview($error, false);
152 152
 }
153 153
 
154
-if(kernelModuleLoad_ctr_test == true)
154
+if (kernelModuleLoad_ctr_test == true)
155 155
 {
156
-    if(cliMode === true)
156
+    if (cliMode === true)
157 157
     {
158 158
         $opt = getopt('f:');
159 159
         
160
-        if(!isset($opt['f']))
160
+        if (!isset($opt['f']))
161 161
         {
162 162
             echo 'Error: No file specified.'."\n";
163 163
             exit;
164 164
         }
165 165
         
166 166
         $file = $opt['f'];
167
-        if(!file_exists(path.'cli/'.$file.'.php'))
167
+        if (!file_exists(path.'cli/'.$file.'.php'))
168 168
         {
169 169
             echo 'File to execute not found.'."\n";
170 170
             exit;
Please login to merge, or discard this patch.
Braces   +11 added lines, -14 removed lines patch added patch discarded remove patch
@@ -78,21 +78,23 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $pathFile = '';
80 80
 
81
-        if(file_exists($rootPath.'web/'.$file)) //Un fichier mit dans /web
81
+        if(file_exists($rootPath.'web/'.$file)) {
82
+            //Un fichier mit dans /web
82 83
         {
83 84
             $pathFile = $rootPath.'web';
84 85
         }
85
-        elseif(strpos($request, '/modules/') !== false) //Un fichier non php mit dans un modules.
86
+        } elseif(strpos($request, '/modules/') !== false) {
87
+            //Un fichier non php mit dans un modules.
86 88
         {
87 89
             $modulePos  = strpos($request, '/modules/') + 9;
90
+        }
88 91
             $moduleName = substr($request, $modulePos, (strpos($request, '/', $modulePos) - $modulePos));
89 92
 
90 93
             if(!file_exists('modules/'.$moduleName.'/externe.php'))
91 94
             {
92 95
                 $error = 403;
93 96
             }
94
-        }
95
-        else
97
+        } else
96 98
         {
97 99
             $error = 404;
98 100
         }
@@ -102,12 +104,10 @@  discard block
 block discarded – undo
102 104
             if($ext == 'css')
103 105
             {
104 106
                 header('Content-type: text/css');
105
-            }
106
-            elseif($ext == 'js')
107
+            } elseif($ext == 'js')
107 108
             {
108 109
                 header('Content-type: text/javascript');
109
-            }
110
-            else
110
+            } else
111 111
             {
112 112
                 $finfo = finfo_open(FILEINFO_MIME_TYPE);
113 113
                 header('Content-type: '.finfo_file($finfo, $pathFile.$file));
@@ -116,8 +116,7 @@  discard block
 block discarded – undo
116 116
             echo file_get_contents($pathFile.$file);
117 117
             exit;
118 118
         }
119
-    }
120
-    elseif(substr($ext, 0, 3) == 'php' && !is_null($ext))
119
+    } elseif(substr($ext, 0, 3) == 'php' && !is_null($ext))
121 120
     {
122 121
         $modulePos  = strpos($request, '/modules/') + 9;
123 122
         $moduleName = substr($request, $modulePos, (strpos($request, '/', $modulePos) - $modulePos));
@@ -130,13 +129,11 @@  discard block
 block discarded – undo
130 129
             if(in_array($afterModuleName, $moduleExterneAuthorized))
131 130
             {
132 131
                 require_once($rootPath.$request);
133
-            }
134
-            else
132
+            } else
135 133
             {
136 134
                 $error = 403;
137 135
             }
138
-        }
139
-        else
136
+        } else
140 137
         {
141 138
             $error = 404;
142 139
         }
Please login to merge, or discard this patch.
src/BFW_init.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
 ob_start(); //Tamporisation du tampon de sortie html. Permet que le code html ne sorte qu'à la fin et non petit à petit (permet d'utiliser les fonctions changeant les headers ou cookie à n'importe quel moment par exemple)
9 9
 
10 10
 //Définition des chemins d'accès
11
-if(!isset($rootPath))
11
+if (!isset($rootPath))
12 12
 {
13
-    if(!isset($myVendorName))
13
+    if (!isset($myVendorName))
14 14
     {
15 15
         $myVendorName = 'vendor';
16 16
     }
@@ -19,30 +19,30 @@  discard block
 block discarded – undo
19 19
 }
20 20
 
21 21
 //Fichier de config
22
-if(!isset($forceConfig) || (isset($forceConfig) && $forceConfig == false))
22
+if (!isset($forceConfig) || (isset($forceConfig) && $forceConfig == false))
23 23
 {
24 24
     require_once($rootPath.'configs/bfw_config.php');
25 25
 }
26 26
 //Fichier de config
27 27
 
28
-if((isset($noSession) && $noSession == false) || !isset($noSession))
28
+if ((isset($noSession) && $noSession == false) || !isset($noSession))
29 29
 { 
30 30
     session_set_cookie_params(0); //permet de detruire le cookie de session si le navigateur quitte
31 31
     session_start(); //Ouverture des sessions
32 32
 }
33 33
 
34 34
 //Class Loader
35
-if(!isset($loader))
35
+if (!isset($loader))
36 36
 {
37 37
     $loader = require($rootPath.'vendor/autoload.php');
38 38
     $loaderAddPsr4 = 'addPsr4';
39 39
 }
40 40
 
41
-if(!isset($loaderAddPsr4)) {$loaderAddPsr4 = 'addNamespace';} //Default of PSR4 library
41
+if (!isset($loaderAddPsr4)) {$loaderAddPsr4 = 'addNamespace'; } //Default of PSR4 library
42 42
 
43 43
 $loader->$loaderAddPsr4('controller\\', $rootPath.'controllers/');
44
-$loader->$loaderAddPsr4('modules\\',    $rootPath.'modules/');
45
-$loader->$loaderAddPsr4('modeles\\',    $rootPath.'modeles/');
44
+$loader->$loaderAddPsr4('modules\\', $rootPath.'modules/');
45
+$loader->$loaderAddPsr4('modeles\\', $rootPath.'modeles/');
46 46
 //Class Loader
47 47
 
48 48
 //Instancie la classe Kernel
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 $modulesToLoad = array();
62 62
 
63 63
 //SQL
64
-if($bd_enabled)
64
+if ($bd_enabled)
65 65
 {
66 66
     $modulesToLoad['bd'] = array('name' => $bd_module, 'action' => 'load');
67 67
 }
@@ -72,32 +72,32 @@  discard block
 block discarded – undo
72 72
 //Controller
73 73
 $modulesToLoad['ctr'] = array('name' => $ctr_module, 'action' => 'test');
74 74
 
75
-foreach($modulesToLoad as $key => $moduleLoad)
75
+foreach ($modulesToLoad as $key => $moduleLoad)
76 76
 {
77
-    if(!empty($moduleLoad['name']))
77
+    if (!empty($moduleLoad['name']))
78 78
     {
79 79
         $pathToModule = $rootPath.'modules/'.$moduleLoad['name'];
80
-        if(empty($pathToModule))
80
+        if (empty($pathToModule))
81 81
         {
82 82
             continue;
83 83
         }
84 84
         
85
-        if(is_link($pathToModule))
85
+        if (is_link($pathToModule))
86 86
         {
87 87
             $pathToModule = readlink($pathToModule);
88 88
             
89
-            if(file_exists($pathToModule.'/bfw_modules_info.php'))
89
+            if (file_exists($pathToModule.'/bfw_modules_info.php'))
90 90
             {
91 91
                 require_once($pathToModule.'/bfw_modules_info.php');
92 92
                 
93
-                if(!empty($modulePath))
93
+                if (!empty($modulePath))
94 94
                 {
95 95
                     $pathToModule .= '/'.$modulePath;
96 96
                 }
97 97
             }
98 98
         }
99 99
         
100
-        if(!file_exists($pathToModule.'/kernel_init.php'))
100
+        if (!file_exists($pathToModule.'/kernel_init.php'))
101 101
         {
102 102
             define('kernelModuleLoad_'.$key.'_test', false);
103 103
             throw new \Exception('Module '.$moduleLoad['name'].' not found.');
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
         define('kernelModuleLoad_'.$key.'_test', true);
107 107
         define('kernelModuleLoad_'.$key.'_path', $pathToModule.'/kernel_init.php');
108 108
         
109
-        if($moduleLoad['action'] == 'load')
109
+        if ($moduleLoad['action'] == 'load')
110 110
         {
111 111
             require_once($pathToModule.'/kernel_init.php');
112 112
         }
113 113
     }
114 114
     
115
-    if(!defined('kernelModuleLoad_'.$key.'_test'))
115
+    if (!defined('kernelModuleLoad_'.$key.'_test'))
116 116
     {
117 117
         define('kernelModuleLoad_'.$key.'_test', false);
118 118
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 //Serveur memcache (permet de stocker des infos direct sur la ram avec ou sans limite dans le temps)
123 123
 $Memcache = null;
124
-if($memcache_enabled === true)
124
+if ($memcache_enabled === true)
125 125
 {
126 126
     $Memcache = new BFW\Ram($memcache_host, $memcache_port);
127 127
 }
@@ -145,30 +145,30 @@  discard block
 block discarded – undo
145 145
  */
146 146
 define('modulesLoadTime_EndInit', 'endInit');
147 147
 
148
-if(file_exists($rootPath.'modules'))
148
+if (file_exists($rootPath.'modules'))
149 149
 {
150 150
     $dir = opendir($rootPath.'modules');
151 151
     $dir_arr = array('.', '..', '.htaccess');
152 152
     
153
-    while(false !== ($moduleName = readdir($dir)))
153
+    while (false !== ($moduleName = readdir($dir)))
154 154
     {
155 155
         $path = $rootPath.'modules/'.$moduleName;
156
-        if(is_link($path)) {$path = readlink($path);}
156
+        if (is_link($path)) {$path = readlink($path); }
157 157
         
158 158
         //Si le fichier existe, on inclus le fichier principal du module
159
-        if(file_exists($path.'/module.json'))
159
+        if (file_exists($path.'/module.json'))
160 160
         {
161 161
             $Modules->newFromJson($path);
162 162
         }
163
-        elseif(file_exists($path.'/'.$moduleName.'.php'))
163
+        elseif (file_exists($path.'/'.$moduleName.'.php'))
164 164
         {
165 165
             require_once($path.'/'.$moduleName.'.php');
166 166
             $Modules->addPath($moduleName, $path);
167 167
         }
168
-        else {continue;}
168
+        else {continue; }
169 169
         
170 170
         $moduleInfos = $Modules->getModuleInfos($moduleName);
171
-        if(!file_exists($path.'/'.$moduleInfos['runFile']))
171
+        if (!file_exists($path.'/'.$moduleInfos['runFile']))
172 172
         {
173 173
             $Modules->loaded($moduleName);
174 174
         }
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 }
179 179
 
180 180
 $modulesToLoad = $Modules->listToLoad(modulesLoadTime_Module);
181
-if(is_array($modulesToLoad) && count($modulesToLoad) > 0)
181
+if (is_array($modulesToLoad) && count($modulesToLoad) > 0)
182 182
 {
183
-    foreach($modulesToLoad as $moduleToLoad)
183
+    foreach ($modulesToLoad as $moduleToLoad)
184 184
     {
185 185
         $infos = $Modules->getModuleInfos($moduleToLoad);
186 186
         $path = $infos['path'];
187 187
         
188
-        if(file_exists($path.'/'.$infos['runFile']))
188
+        if (file_exists($path.'/'.$infos['runFile']))
189 189
         {
190 190
             $Modules->loaded($moduleToLoad);
191 191
             require_once($path.'/'.$infos['runFile']);
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 
201 201
 //Chargement des modules
202 202
 $modulesToLoad = $Modules->listToLoad(modulesLoadTime_Visiteur);
203
-if(is_array($modulesToLoad) && count($modulesToLoad) > 0)
203
+if (is_array($modulesToLoad) && count($modulesToLoad) > 0)
204 204
 {
205
-    foreach($modulesToLoad as $moduleToLoad)
205
+    foreach ($modulesToLoad as $moduleToLoad)
206 206
     {
207 207
         $infos = $Modules->getModuleInfos($moduleToLoad);
208 208
         $path = $infos['path'];
209 209
         
210
-        if(file_exists($path.'/'.$infos['runFile']))
210
+        if (file_exists($path.'/'.$infos['runFile']))
211 211
         {
212 212
             $Modules->loaded($moduleToLoad);
213 213
             require_once($path.'/'.$infos['runFile']);
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 
251 251
 //Chargement des modules
252 252
 $modulesToLoad = $Modules->listToLoad(modulesLoadTime_EndInit);
253
-if(is_array($modulesToLoad) && count($modulesToLoad) > 0)
253
+if (is_array($modulesToLoad) && count($modulesToLoad) > 0)
254 254
 {
255
-    foreach($modulesToLoad as $moduleToLoad)
255
+    foreach ($modulesToLoad as $moduleToLoad)
256 256
     {
257 257
         $infos = $Modules->getModuleInfos($moduleToLoad);
258 258
         $path = $infos['path'];
259 259
         
260
-        if(file_exists($path.'/'.$infos['runFile']))
260
+        if (file_exists($path.'/'.$infos['runFile']))
261 261
         {
262 262
             $Modules->loaded($moduleToLoad);
263 263
             require_once($path.'/'.$infos['runFile']);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -159,13 +159,11 @@
 block discarded – undo
159 159
         if(file_exists($path.'/module.json'))
160 160
         {
161 161
             $Modules->newFromJson($path);
162
-        }
163
-        elseif(file_exists($path.'/'.$moduleName.'.php'))
162
+        } elseif(file_exists($path.'/'.$moduleName.'.php'))
164 163
         {
165 164
             require_once($path.'/'.$moduleName.'.php');
166 165
             $Modules->addPath($moduleName, $path);
167
-        }
168
-        else {continue;}
166
+        } else {continue;}
169 167
         
170 168
         $moduleInfos = $Modules->getModuleInfos($moduleName);
171 169
         if(!file_exists($path.'/'.$moduleInfos['runFile']))
Please login to merge, or discard this patch.
src/app/error.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if($DebugMode && $errorRender)
2
+if ($DebugMode && $errorRender)
3 3
 {
4 4
     function exception_handler($exception)
5 5
     {
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     
16 16
     set_exception_handler('exception_handler');
17 17
         
18
-    set_error_handler(function ($err_severity, $err_msg, $err_file, $err_line)
18
+    set_error_handler(function($err_severity, $err_msg, $err_file, $err_line)
19 19
     {
20 20
         /*
21 21
         http://fr2.php.net/manual/fr/function.set-error-handler.php#113567
@@ -37,29 +37,29 @@  discard block
 block discarded – undo
37 37
        / 32767    E_ALL (integer)               All errors and warnings, as supported, except of level E_STRICT prior to PHP 5.4.0.     32767 in PHP 5.4.x, 30719 in PHP 5.3.x, 6143 in PHP 5.2.x, 2047 previously
38 38
         */
39 39
         
40
-        if(
40
+        if (
41 41
             $err_severity == E_ERROR || 
42 42
             $err_severity == E_CORE_ERROR || 
43 43
             $err_severity == E_USER_ERROR || 
44 44
             $err_severity == E_COMPILE_ERROR || 
45 45
             $err_severity == E_RECOVERABLE_ERROR
46 46
         )
47
-        {$erreurType = 'Fatal';}
47
+        {$erreurType = 'Fatal'; }
48 48
         
49
-        elseif(
49
+        elseif (
50 50
             $err_severity == E_WARNING || 
51 51
             $err_severity == E_CORE_WARNING || 
52 52
             $err_severity == E_USER_WARNING || 
53 53
             $err_severity == E_COMPILE_WARNING
54 54
         )
55
-        {$erreurType = 'Fatal';}
55
+        {$erreurType = 'Fatal'; }
56 56
         
57
-        elseif($err_severity == E_PARSE) {$erreurType = 'Parse';}
58
-        elseif($err_severity == E_NOTICE || $err_severity == E_USER_NOTICE) {$erreurType = 'Notice';}
59
-        elseif($err_severity == E_STRICT) {$erreurType = 'Strict';}
60
-        elseif($err_severity == E_RECOVERABLE_ERROR) {$erreurType = '/';}
61
-        elseif($err_severity == E_DEPRECATED || $err_severity == E_USER_DEPRECATED) {$erreurType = 'Deprecated';}
62
-        else {$erreurType = 'Unknow';}
57
+        elseif ($err_severity == E_PARSE) {$erreurType = 'Parse'; }
58
+        elseif ($err_severity == E_NOTICE || $err_severity == E_USER_NOTICE) {$erreurType = 'Notice'; }
59
+        elseif ($err_severity == E_STRICT) {$erreurType = 'Strict'; }
60
+        elseif ($err_severity == E_RECOVERABLE_ERROR) {$erreurType = '/'; }
61
+        elseif ($err_severity == E_DEPRECATED || $err_severity == E_USER_DEPRECATED) {$erreurType = 'Deprecated'; }
62
+        else {$erreurType = 'Unknow'; }
63 63
         
64 64
         global $errorRender;
65 65
         $errorRender($erreurType, $err_msg, $err_file, $err_line, debug_backtrace());
@@ -91,27 +91,27 @@  discard block
 block discarded – undo
91 91
                     <p class="title">Niarf, une erreur s\'est produite</p>
92 92
                     <p class="info">'.$erreurType.' Error : <strong>'.$err_msg.'</strong> in '.$err_file.' at line '.$err_line.'</p>
93 93
                     <fieldset><pre>';
94
-                        foreach($backtrace as $i => $info)
94
+                        foreach ($backtrace as $i => $info)
95 95
                         {
96 96
                             echo '#'.$i.'  '.$info['function'];
97 97
                             
98
-                            if(isset($info['args']) && count($info['args']) > 0)
98
+                            if (isset($info['args']) && count($info['args']) > 0)
99 99
                             {
100 100
                                 echo '(';
101 101
                                 
102
-                                foreach($info['args'] as $iArgs => $args)
102
+                                foreach ($info['args'] as $iArgs => $args)
103 103
                                 {
104
-                                    if($iArgs > 0) {echo ', ';}
104
+                                    if ($iArgs > 0) {echo ', '; }
105 105
                                     
106
-                                        if(is_array($args) || is_object($args)) {echo gettype($args);}
107
-                                    elseif(is_null($args)) {echo 'null';}
108
-                                    else {echo htmlentities($args);}
106
+                                        if (is_array($args) || is_object($args)) {echo gettype($args); }
107
+                                    elseif (is_null($args)) {echo 'null'; }
108
+                                    else {echo htmlentities($args); }
109 109
                                 }
110 110
                                 
111 111
                                 echo ')';
112 112
                             }
113 113
                             
114
-                            if(isset($info['file'], $info['line']))
114
+                            if (isset($info['file'], $info['line']))
115 115
                             {
116 116
                                 echo ' called at ['.$info['file'].' line '.$info['line'].']';
117 117
                             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -14 removed lines patch added patch discarded remove patch
@@ -44,22 +44,13 @@  discard block
 block discarded – undo
44 44
             $err_severity == E_COMPILE_ERROR || 
45 45
             $err_severity == E_RECOVERABLE_ERROR
46 46
         )
47
-        {$erreurType = 'Fatal';}
48
-        
49
-        elseif(
47
+        {$erreurType = 'Fatal';} elseif(
50 48
             $err_severity == E_WARNING || 
51 49
             $err_severity == E_CORE_WARNING || 
52 50
             $err_severity == E_USER_WARNING || 
53 51
             $err_severity == E_COMPILE_WARNING
54 52
         )
55
-        {$erreurType = 'Fatal';}
56
-        
57
-        elseif($err_severity == E_PARSE) {$erreurType = 'Parse';}
58
-        elseif($err_severity == E_NOTICE || $err_severity == E_USER_NOTICE) {$erreurType = 'Notice';}
59
-        elseif($err_severity == E_STRICT) {$erreurType = 'Strict';}
60
-        elseif($err_severity == E_RECOVERABLE_ERROR) {$erreurType = '/';}
61
-        elseif($err_severity == E_DEPRECATED || $err_severity == E_USER_DEPRECATED) {$erreurType = 'Deprecated';}
62
-        else {$erreurType = 'Unknow';}
53
+        {$erreurType = 'Fatal';} elseif($err_severity == E_PARSE) {$erreurType = 'Parse';} elseif($err_severity == E_NOTICE || $err_severity == E_USER_NOTICE) {$erreurType = 'Notice';} elseif($err_severity == E_STRICT) {$erreurType = 'Strict';} elseif($err_severity == E_RECOVERABLE_ERROR) {$erreurType = '/';} elseif($err_severity == E_DEPRECATED || $err_severity == E_USER_DEPRECATED) {$erreurType = 'Deprecated';} else {$erreurType = 'Unknow';}
63 54
         
64 55
         global $errorRender;
65 56
         $errorRender($erreurType, $err_msg, $err_file, $err_line, debug_backtrace());
@@ -103,9 +94,7 @@  discard block
 block discarded – undo
103 94
                                 {
104 95
                                     if($iArgs > 0) {echo ', ';}
105 96
                                     
106
-                                        if(is_array($args) || is_object($args)) {echo gettype($args);}
107
-                                    elseif(is_null($args)) {echo 'null';}
108
-                                    else {echo htmlentities($args);}
97
+                                        if(is_array($args) || is_object($args)) {echo gettype($args);} elseif(is_null($args)) {echo 'null';} else {echo htmlentities($args);}
109 98
                                 }
110 99
                                 
111 100
                                 echo ')';
Please login to merge, or discard this patch.
src/interfaces/IDate.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * 
71 71
      * @param string $date (default: "now") La date sur laquelle travailler. Si pas indiqué, il s'agit de la date actuelle.
72 72
      */
73
-    public function __construct($date="now");
73
+    public function __construct($date = "now");
74 74
     
75 75
     /**
76 76
      * Modifie une données de la date
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * Si string : aaaa-mm-jj hh:mm:ss
93 93
      * Si array : [0]=>partie date (aaaa-mm-jj), [1]=>partie heure (hh:mm:ss)
94 94
      */
95
-    public function getSql($decoupe=false);
95
+    public function getSql($decoupe = false);
96 96
     
97 97
     /**
98 98
      * Modifie le timezone
@@ -161,5 +161,5 @@  discard block
 block discarded – undo
161 161
      * 
162 162
      * @return string La date simplifié
163 163
      */
164
-    public function aff_simple($tout=1, $minus=false);
164
+    public function aff_simple($tout = 1, $minus = false);
165 165
 }
Please login to merge, or discard this patch.