Passed
Push — main ( 3399b6...dd4eea )
by Dimitri
11:50
created
src/Loader/Load.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             return $models;
74 74
         }
75 75
 
76
-        if (! self::isLoaded('models', $model)) {
76
+        if (!self::isLoaded('models', $model)) {
77 77
             self::loaded('models', $model, FileLocator::model($model, $connection));
78 78
         }
79 79
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     private static function isLoaded(string $module, $element): bool
89 89
     {
90
-        if (! isset(self::$loads[$module]) || ! is_array(self::$loads[$module])) {
90
+        if (!isset(self::$loads[$module]) || !is_array(self::$loads[$module])) {
91 91
             return false;
92 92
         }
93 93
 
Please login to merge, or discard this patch.
src/Loader/FileLocator.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
         $loader = Services::locator();
39 39
 
40
-        if (! is_array($filenames)) {
40
+        if (!is_array($filenames)) {
41 41
             $filenames = [$filenames];
42 42
         }
43 43
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                 }
82 82
 
83 83
                 // Les helpers au niveau de l'application doivent remplacer tous les autres
84
-                if (! empty($appHelper)) {
84
+                if (!empty($appHelper)) {
85 85
                     $includes[] = $appHelper;
86 86
                     $loaded[]   = $filename;
87 87
                 }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 $includes = [...$includes, ...$localIncludes];
91 91
 
92 92
                 // Et celui par défaut du système doit être ajouté en dernier.
93
-                if (! empty($systemHelper)) {
93
+                if (!empty($systemHelper)) {
94 94
                     $includes[] = $systemHelper;
95 95
                     $loaded[]   = $filename;
96 96
                 }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             throw LoadException::libraryNotFound($lib);
137 137
         }
138 138
 
139
-        if (true !== $file_syst && ! class_exists($lib)) {
139
+        if (true !== $file_syst && !class_exists($lib)) {
140 140
             throw LoadException::libraryDontExist($lib);
141 141
         }
142 142
 
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public static function model(string $model, ?ConnectionInterface $connection = null)
156 156
     {
157
-        if (! class_exists($model) && ! Text::endsWith($model, 'Model')) {
157
+        if (!class_exists($model) && !Text::endsWith($model, 'Model')) {
158 158
             $model .= 'Model';
159 159
         }
160 160
 
161
-        if (! class_exists($model)) {
161
+        if (!class_exists($model)) {
162 162
             $model = str_replace(APP_NAMESPACE . '\\Models\\', '', $model);
163 163
             $model = APP_NAMESPACE . '\\Models\\' . $model;
164 164
         }
165 165
 
166
-        if (! class_exists($model)) {
166
+        if (!class_exists($model)) {
167 167
             throw LoadException::modelNotFound($model);
168 168
         }
169 169
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         $controller = explode('/', $controller);
182 182
 
183 183
         $con                                = ucfirst(end($controller));
184
-        $con                                = (! preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con;
184
+        $con                                = (!preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con;
185 185
         $controller[count($controller) - 1] = $con;
186 186
 
187 187
         foreach ($controller as $key => &$value) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
         $path = CONTROLLER_PATH . Helpers::ensureExt(implode(DS, $controller), 'php');
194 194
 
195
-        if (! file_exists($path)) {
195
+        if (!file_exists($path)) {
196 196
             throw LoadException::controllerNotFound(str_replace('Controller', '', $con), $path);
197 197
         }
198 198
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         if (class_exists($class_namespaced, false)) {
204 204
             return Injector::make($class_namespaced);
205 205
         }
206
-        if (! class_exists($con, false)) {
206
+        if (!class_exists($con, false)) {
207 207
             throw LoadException::controllerDontExist(str_replace('Controller', '', $con), $path);
208 208
         }
209 209
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     protected static function verifyPreferApp(array $options, string $name): bool
233 233
     {
234 234
         // Tout element sans restriction passe
235
-        if (! $options['preferApp']) {
235
+        if (!$options['preferApp']) {
236 236
             return true;
237 237
         }
238 238
 
Please login to merge, or discard this patch.
src/Debug/Whoops.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public static function init()
38 38
     {
39
-        if (! class_exists('Whoops\Run')) {
39
+        if (!class_exists('Whoops\Run')) {
40 40
             return;
41 41
         }
42 42
 
43 43
         $whoops = new Run();
44 44
 
45
-        if (! is_online()) {
45
+        if (!is_online()) {
46 46
             if (Misc::isCommandLine()) {
47 47
                 $whoops->pushHandler(new PlainTextHandler());
48 48
             } elseif (Misc::isAjaxRequest()) {
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         /**
56 56
          * On log toutes les erreurs
57 57
          */
58
-        $whoops->pushHandler(static function (Throwable $exception, Inspector $inspector, RunInterface $run) {
58
+        $whoops->pushHandler(static function(Throwable $exception, Inspector $inspector, RunInterface $run) {
59 59
             Services::logger()->error($exception);
60 60
 
61 61
             return Handler::DONE;
Please login to merge, or discard this patch.
src/Helpers/url.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 // =================================  ================================= //
26 26
 
27
-if (! function_exists('site_url')) {
27
+if (!function_exists('site_url')) {
28 28
     /**
29 29
      * Renvoie une URL de site telle que définie par la configuration de l'application.
30 30
      *
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     }
49 49
 }
50 50
 
51
-if (! function_exists('base_url')) {
51
+if (!function_exists('base_url')) {
52 52
     /**
53 53
      * Renvoie l'URL de base telle que définie par la configuration de l'application.
54 54
      * Les URL de base sont des URL de site coupées sans la page d'index.
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     }
68 68
 }
69 69
 
70
-if (! function_exists('current_url')) {
70
+if (!function_exists('current_url')) {
71 71
     /**
72 72
      * Renvoie l'URL complète (y compris les segments) de la page où cette fonction est placée
73 73
      *
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     }
95 95
 }
96 96
 
97
-if (! function_exists('previous_url')) {
97
+if (!function_exists('previous_url')) {
98 98
     /**
99 99
      * Renvoie l'URL précédente sur laquelle se trouvait le visiteur actuel. Pour des raisons de sécurité
100 100
      * nous vérifions d'abord une variable de session enregistrée, si elle existe, et l'utilisons.
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     }
120 120
 }
121 121
 
122
-if (! function_exists('uri_string')) {
122
+if (!function_exists('uri_string')) {
123 123
     /**
124 124
      * Renvoie la partie chemin de l'URL actuelle
125 125
      *
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     }
134 134
 }
135 135
 
136
-if (! function_exists('index_page')) {
136
+if (!function_exists('index_page')) {
137 137
     /**
138 138
      * Renvoie la "index_page" de votre fichier de configuration
139 139
      */
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     }
144 144
 }
145 145
 
146
-if (! function_exists('anchor')) {
146
+if (!function_exists('anchor')) {
147 147
     /**
148 148
      * Crée une ancre basée sur l'URL locale.
149 149
      *
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     }
169 169
 }
170 170
 
171
-if (! function_exists('anchor_popup')) {
171
+if (!function_exists('anchor_popup')) {
172 172
     /**
173 173
      * Lien d'ancrage - Version contextuelle
174 174
      *
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
             return '<a href="' . $siteUrl . '" onclick="window.open(\'' . $siteUrl . "', '_blank'); return false;\">" . $title . '</a>';
192 192
         }
193 193
 
194
-        if (! is_array($attributes)) {
194
+        if (!is_array($attributes)) {
195 195
             $attributes = [$attributes];
196 196
 
197 197
             // Ref: http://www.w3schools.com/jsref/met_win_open.asp
198 198
             $windowName = '_blank';
199
-        } elseif (! empty($attributes['window_name'])) {
199
+        } elseif (!empty($attributes['window_name'])) {
200 200
             $windowName = $attributes['window_name'];
201 201
             unset($attributes['window_name']);
202 202
         } else {
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     }
217 217
 }
218 218
 
219
-if (! function_exists('mailto')) {
219
+if (!function_exists('mailto')) {
220 220
     /**
221 221
      * Lien Mailto
222 222
      *
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     }
234 234
 }
235 235
 
236
-if (! function_exists('safe_mailto')) {
236
+if (!function_exists('safe_mailto')) {
237 237
     /**
238 238
      * Lien Mailto codé
239 239
      *
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
     }
323 323
 }
324 324
 
325
-if (! function_exists('auto_link')) {
325
+if (!function_exists('auto_link')) {
326 326
     /**
327 327
      * Lien automatique
328 328
      *
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
     function auto_link(string $str, string $type = 'both', bool $popup = false): string
338 338
     {
339 339
         // Recherche et remplace tous les URLs.
340
-        if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
340
+        if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE|PREG_SET_ORDER)) {
341 341
             // Définissez notre HTML cible si vous utilisez des liens contextuels.
342 342
             $target = ($popup) ? ' target="_blank"' : '';
343 343
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     }
369 369
 }
370 370
 
371
-if (! function_exists('prep_url')) {
371
+if (!function_exists('prep_url')) {
372 372
     /**
373 373
      * Ajoute simplement la partie http:// ou https:// si aucun schéma n'est inclus.
374 374
      *
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     }
394 394
 }
395 395
 
396
-if (! function_exists('url_title')) {
396
+if (!function_exists('url_title')) {
397 397
     /**
398 398
      * Créer un titre d'URL
399 399
      *
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
     }
430 430
 }
431 431
 
432
-if (! function_exists('mb_url_title')) {
432
+if (!function_exists('mb_url_title')) {
433 433
     /**
434 434
      * Créer un titre d'URL qui prend en compte les caractères accentués
435 435
      *
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     }
449 449
 }
450 450
 
451
-if (! function_exists('url_to')) {
451
+if (!function_exists('url_to')) {
452 452
     /**
453 453
      * Obtenir l'URL complète et absolue d'une méthode de contrôleur
454 454
      * (avec arguments supplémentaires)
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
      */
462 462
     function url_to(string $controller, ...$args): string
463 463
     {
464
-        if (! $route = link_to($controller, ...$args)) {
464
+        if (!$route = link_to($controller, ...$args)) {
465 465
             $explode = explode('::', $controller);
466 466
 
467 467
             if (isset($explode[1])) {
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
     }
476 476
 }
477 477
 
478
-if (! function_exists('url_is')) {
478
+if (!function_exists('url_is')) {
479 479
     /**
480 480
      * Détermine si le chemin d'URL actuel contient le chemin donné.
481 481
      * Il peut contenir un caractère générique (*) qui autorisera tout caractère valide.
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
     }
494 494
 }
495 495
 
496
-if (! function_exists('link_active')) {
496
+if (!function_exists('link_active')) {
497 497
     /**
498 498
      * Lien actif dans la navbar
499 499
      * Un peut comme le router-active-link de vuejs
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
             return $active_class;
509 509
         }
510 510
         
511
-        if (! $exact && preg_match('#^' . $path . '/?#i', $current_section)) {
511
+        if (!$exact && preg_match('#^' . $path . '/?#i', $current_section)) {
512 512
             return $active_class;
513 513
         }
514 514
         
@@ -520,14 +520,14 @@  discard block
 block discarded – undo
520 520
     }
521 521
 }
522 522
 
523
-if (! function_exists('clean_url')) {
523
+if (!function_exists('clean_url')) {
524 524
     function clean_url(string $url): string
525 525
     {
526 526
         return Helpers::cleanUrl($url);
527 527
     }
528 528
 }
529 529
 
530
-if (! function_exists('is_absolute_link')) {
530
+if (!function_exists('is_absolute_link')) {
531 531
     /**
532 532
      * Verifies si un chemin donnée est une url absolue ou relative
533 533
      */
Please login to merge, or discard this patch.
src/Helpers/scl.php 2 patches
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 function scl_generateKeys($nbr = 8, $type = 0)
293 293
 {
294 294
     /* Valeurs par défaut */
295
-    $nbr = (empty($nbr)) ? 8 : (int)$nbr;
296
-    $nbr = (!is_int($nbr)) ? 8 : (int)$nbr;
297
-    $nbr = ($nbr < 3 OR $nbr > 64) ? 8 : (int)$nbr;
295
+    $nbr = (empty($nbr)) ? 8 : (int) $nbr;
296
+    $nbr = (!is_int($nbr)) ? 8 : (int) $nbr;
297
+    $nbr = ($nbr < 3 OR $nbr > 64) ? 8 : (int) $nbr;
298 298
 
299 299
     switch ($type) {
300 300
         case 1 :
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     $interval = (!is_bool($interval)) ? true : $interval; // Specifie si on gere les intervales ou pas
350 350
     $interval = ($interval == false) ? false : true; // Specifie si on gere les intervales ou pas
351 351
 
352
-    $date = new DateTime($date);  // On contruit la date
352
+    $date = new DateTime($date); // On contruit la date
353 353
 
354 354
     // Si on ne gere pas les intervales
355 355
     if ($interval == false) {
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
         'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
591 591
         'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
592 592
     );
593
-    $chars = explode(' ', $chars);  // On transforme la chaine précédement créée en tableau
593
+    $chars = explode(' ', $chars); // On transforme la chaine précédement créée en tableau
594 594
     $return = '';
595 595
 
596 596
     // On parcours tout le dit tableau (ie. on recupere les caracteres un a un)
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 {
781 781
     $file = trim(htmlspecialchars($file));
782 782
     if (is_file($file) AND file_exists($file)) {
783
-        extract((array)$data);
783
+        extract((array) $data);
784 784
         include_once($file);
785 785
     }
786 786
     else if ($exception) {
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 {
805 805
     $vars = (array) $var;
806 806
 
807
-    if(true !== (bool) $style)
807
+    if (true !== (bool) $style)
808 808
     {
809 809
         echo "<pre style=\"background:#eee;padding:1em;border:1px inset #adb5bd;border-radius:5px;font-family:monospace;margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar;\">\n";
810 810
         foreach ($vars As $var) {
@@ -819,59 +819,59 @@  discard block
 block discarded – undo
819 819
 
820 820
     foreach ($vars As $var)
821 821
     {
822
-        if($i != 0) {
822
+        if ($i != 0) {
823 823
             echo '<hr style="height:1;margin:0;margin-top:1em;" color="#ddd" size="1">';
824 824
         }
825 825
         $i++;
826 826
 
827 827
         echo '<span style="width:auto;display:inline-block; margin-bottom: .25em; font-weight:bold;font-family:\'Lato\', candara, \'Arial Narrow\', sans-serif; color:#6c17cb; font-style:italic">';
828 828
         echo ucfirst(gettype($var));
829
-        if(is_object($var)) {
830
-            echo ' | '.get_class($var);
829
+        if (is_object($var)) {
830
+            echo ' | ' . get_class($var);
831 831
         }
832 832
 
833
-        if(is_string($var)) {
834
-            echo '<span style="width:auto;font-weight:lighter !important; display:inline-block; padding-left:.5em; color:crimson">(lenght : '.strlen($var).')</span>';
833
+        if (is_string($var)) {
834
+            echo '<span style="width:auto;font-weight:lighter !important; display:inline-block; padding-left:.5em; color:crimson">(lenght : ' . strlen($var) . ')</span>';
835 835
         }
836
-        if(is_array($var)) {
837
-            echo '<span style="width:auto;font-weight:lighter !important; display:inline-block; padding-left:.5em; color:crimson">(lenght : '.count($var).')</span>';
836
+        if (is_array($var)) {
837
+            echo '<span style="width:auto;font-weight:lighter !important; display:inline-block; padding-left:.5em; color:crimson">(lenght : ' . count($var) . ')</span>';
838 838
         }
839 839
         echo "</span>";
840 840
 
841
-        if(is_null($var)) {
841
+        if (is_null($var)) {
842 842
             echo "\n\tNULL";
843 843
         }
844
-        else if(is_string($var) OR is_numeric($var))
844
+        else if (is_string($var) OR is_numeric($var))
845 845
         {
846
-            echo "\n\t".$var;
846
+            echo "\n\t" . $var;
847 847
         }
848
-        else if(is_bool($var)) {
848
+        else if (is_bool($var)) {
849 849
             echo (true === $var) ? "\n\ttrue" : "\n\tfalse";
850 850
         }
851
-        else if(is_array($var) OR is_object($var))
851
+        else if (is_array($var) OR is_object($var))
852 852
         {
853
-            if(empty($var)) {
853
+            if (empty($var)) {
854 854
                 echo "\n\tempty";
855 855
             }
856 856
             else
857 857
             {
858
-                foreach($var As $key => $value)
858
+                foreach ($var As $key => $value)
859 859
                 {
860 860
                     echo "\n\t<span style=\"width:auto;display:inline-block; margin: .25em; 0\">";
861
-                    echo "<b>".$key."</b> => ";
862
-                    if(is_array($value) OR is_object($value)) {
861
+                    echo "<b>" . $key . "</b> => ";
862
+                    if (is_array($value) OR is_object($value)) {
863 863
                         scl_debug($value);
864 864
                     }
865 865
                     else {
866
-                        if(is_bool($value)) {
866
+                        if (is_bool($value)) {
867 867
                             echo (true === $value) ? 'true' : 'false';
868 868
                         }
869 869
                         else {
870 870
                             echo $value;
871 871
                         }
872
-                        echo '<span style="auto;font-weight:lighter !important; display:inline-block; padding-left:.5em; color:#eb7c55">['.ucfirst(gettype($value));
873
-                        if(is_string($value)) {
874
-                            echo '('.strlen($value).')';
872
+                        echo '<span style="auto;font-weight:lighter !important; display:inline-block; padding-left:.5em; color:#eb7c55">[' . ucfirst(gettype($value));
873
+                        if (is_string($value)) {
874
+                            echo '(' . strlen($value) . ')';
875 875
                         }
876 876
                         echo ']</span>';
877 877
                     }
@@ -902,8 +902,8 @@  discard block
 block discarded – undo
902 902
  */
903 903
 function scl_byte2size($bytes, $format = 1024, $precision = 2)
904 904
 {
905
-    $unit = array('B','KB','MB', 'GB', 'TB');
906
-    return @round($bytes / pow($format, ($i = floor(log($bytes, $format)))), $precision).' '.$unit[$i];
905
+    $unit = array('B', 'KB', 'MB', 'GB', 'TB');
906
+    return @round($bytes / pow($format, ($i = floor(log($bytes, $format)))), $precision) . ' ' . $unit[$i];
907 907
 }
908 908
 
909 909
 
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 function scl_getTags($content, $nb_tags = 10, $relief = false, $mots_a_bannir = null)
1042 1042
 {
1043 1043
     /* Valeurs par défaut */
1044
-    $nb_tags = (empty($nb_tags)) ? 10 : (int)$nb_tags;
1044
+    $nb_tags = (empty($nb_tags)) ? 10 : (int) $nb_tags;
1045 1045
     $relief = ($relief != true) ? false : true;
1046 1046
 
1047 1047
     if (is_file($mots_a_bannir) AND file_exists($mots_a_bannir)) {
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 
1068 1068
         #---------------Caracteres HTML---------------
1069 1069
         'AGRAVE', 'EACUTE', 'NBSP',
1070
-    ), (array)$mots_a_bannir);
1070
+    ), (array) $mots_a_bannir);
1071 1071
 
1072 1072
     foreach ($mots_a_bannir As $banni) {
1073 1073
         $content = preg_replace('#' . $banni . '#iSu', '', $content); //Supprime les mots à bannir
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
             $render_array[] = $key . " ";
1098 1098
         }
1099 1099
     }
1100
-    srand((float)microtime() * 1000000);
1100
+    srand((float) microtime() * 1000000);
1101 1101
     shuffle($render_array); //On mélange aléatoirement le tableau
1102 1102
     $return = ''; // La variable de retour
1103 1103
     foreach ($render_array as $value) {
@@ -1118,160 +1118,160 @@  discard block
 block discarded – undo
1118 1118
  */
1119 1119
 function scl_int2letter($int)
1120 1120
 {
1121
-    $int_val= intval($int);
1121
+    $int_val = intval($int);
1122 1122
     $real_val = intval(round($int - intval($int), 2) * 1000);
1123 1123
 
1124
-    if($int_val == 0) {
1124
+    if ($int_val == 0) {
1125 1125
         return 'Zero';
1126 1126
     }
1127 1127
     $return = '';
1128 1128
 
1129
-    $dix_c = intval($real_val%100/10);
1130
-    $cent_c = intval($real_val%1000/100);
1131
-    $unite[1] = $int_val%10;
1132
-    $dix[1] = intval($int_val%100/10);
1133
-    $cent[1] =intval($int_val%1000/100);
1134
-    $unite[2]=intval($int_val%10000/1000);
1135
-    $dix[2] = intval($int_val%100000/10000);
1136
-    $cent[2] = intval($int_val%1000000/100000);
1137
-    $unite[3] = intval($int_val%10000000/1000000);
1138
-    $dix[3] = intval($int_val%100000000/10000000);
1139
-    $cent[3] = intval($int_val%1000000000/100000000);
1129
+    $dix_c = intval($real_val % 100 / 10);
1130
+    $cent_c = intval($real_val % 1000 / 100);
1131
+    $unite[1] = $int_val % 10;
1132
+    $dix[1] = intval($int_val % 100 / 10);
1133
+    $cent[1] = intval($int_val % 1000 / 100);
1134
+    $unite[2] = intval($int_val % 10000 / 1000);
1135
+    $dix[2] = intval($int_val % 100000 / 10000);
1136
+    $cent[2] = intval($int_val % 1000000 / 100000);
1137
+    $unite[3] = intval($int_val % 10000000 / 1000000);
1138
+    $dix[3] = intval($int_val % 100000000 / 10000000);
1139
+    $cent[3] = intval($int_val % 1000000000 / 100000000);
1140 1140
 
1141 1141
     $chif = array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf');
1142 1142
 
1143
-    $trio_c='';
1144
-    for($i=1; $i<=3; $i++)
1143
+    $trio_c = '';
1144
+    for ($i = 1; $i <= 3; $i++)
1145 1145
     {
1146
-        $prim[$i]='';
1147
-        $secon[$i]='';
1148
-        $trio[$i]='';
1146
+        $prim[$i] = '';
1147
+        $secon[$i] = '';
1148
+        $trio[$i] = '';
1149 1149
 
1150
-        if($dix[$i]==0) {
1151
-            $secon[$i]=''; $prim[$i]=$chif[$unite[$i]];
1150
+        if ($dix[$i] == 0) {
1151
+            $secon[$i] = ''; $prim[$i] = $chif[$unite[$i]];
1152 1152
         }
1153
-        else if($dix[$i]==1) {
1154
-            $secon[$i]=''; $prim[$i]=$chif[($unite[$i]+10)];
1153
+        else if ($dix[$i] == 1) {
1154
+            $secon[$i] = ''; $prim[$i] = $chif[($unite[$i] + 10)];
1155 1155
         }
1156
-        else if($dix[$i]==2)
1156
+        else if ($dix[$i] == 2)
1157 1157
         {
1158
-            if($unite[$i]==1) {
1159
-                $secon[$i]='vingt et'; $prim[$i]=$chif[$unite[$i]];
1158
+            if ($unite[$i] == 1) {
1159
+                $secon[$i] = 'vingt et'; $prim[$i] = $chif[$unite[$i]];
1160 1160
             }
1161 1161
             else {
1162
-                $secon[$i]='vingt'; $prim[$i]=$chif[$unite[$i]];
1162
+                $secon[$i] = 'vingt'; $prim[$i] = $chif[$unite[$i]];
1163 1163
             }
1164 1164
         }
1165
-        else if($dix[$i]==3)
1165
+        else if ($dix[$i] == 3)
1166 1166
         {
1167
-            if($unite[$i]==1) {
1168
-                $secon[$i]='trente et'; $prim[$i]=$chif[$unite[$i]];
1167
+            if ($unite[$i] == 1) {
1168
+                $secon[$i] = 'trente et'; $prim[$i] = $chif[$unite[$i]];
1169 1169
             }
1170 1170
             else {
1171
-                $secon[$i]='trente'; $prim[$i]=$chif[$unite[$i]];
1171
+                $secon[$i] = 'trente'; $prim[$i] = $chif[$unite[$i]];
1172 1172
             }
1173 1173
         }
1174
-        else if($dix[$i]==4)
1174
+        else if ($dix[$i] == 4)
1175 1175
         {
1176
-            if($unite[$i]==1) {
1177
-                $secon[$i]='quarante et'; $prim[$i]=$chif[$unite[$i]];
1176
+            if ($unite[$i] == 1) {
1177
+                $secon[$i] = 'quarante et'; $prim[$i] = $chif[$unite[$i]];
1178 1178
             }
1179 1179
             else {
1180
-                $secon[$i]='quarante'; $prim[$i]=$chif[$unite[$i]];
1180
+                $secon[$i] = 'quarante'; $prim[$i] = $chif[$unite[$i]];
1181 1181
             }
1182 1182
         }
1183
-        else if($dix[$i]==5)
1183
+        else if ($dix[$i] == 5)
1184 1184
         {
1185
-            if($unite[$i]==1) {
1186
-                $secon[$i]='cinquante et'; $prim[$i]=$chif[$unite[$i]];
1185
+            if ($unite[$i] == 1) {
1186
+                $secon[$i] = 'cinquante et'; $prim[$i] = $chif[$unite[$i]];
1187 1187
             }
1188 1188
             else {
1189
-                $secon[$i]='cinquante'; $prim[$i]=$chif[$unite[$i]];
1189
+                $secon[$i] = 'cinquante'; $prim[$i] = $chif[$unite[$i]];
1190 1190
             }
1191 1191
         }
1192
-        else if($dix[$i]==6)
1192
+        else if ($dix[$i] == 6)
1193 1193
         {
1194
-            if($unite[$i]==1) {
1195
-                $secon[$i]='soixante et'; $prim[$i]=$chif[$unite[$i]];
1194
+            if ($unite[$i] == 1) {
1195
+                $secon[$i] = 'soixante et'; $prim[$i] = $chif[$unite[$i]];
1196 1196
             }
1197 1197
             else {
1198
-                $secon[$i]='soixante'; $prim[$i]=$chif[$unite[$i]];
1198
+                $secon[$i] = 'soixante'; $prim[$i] = $chif[$unite[$i]];
1199 1199
             }
1200 1200
         }
1201
-        else if($dix[$i]==7)
1201
+        else if ($dix[$i] == 7)
1202 1202
         {
1203
-            if($unite[$i]==1) {
1204
-                $secon[$i]='soixante et'; $prim[$i]=$chif[$unite[$i]+10];
1203
+            if ($unite[$i] == 1) {
1204
+                $secon[$i] = 'soixante et'; $prim[$i] = $chif[$unite[$i] + 10];
1205 1205
             }
1206 1206
             else {
1207
-                $secon[$i]='soixante'; $prim[$i]=$chif[$unite[$i]+10];
1207
+                $secon[$i] = 'soixante'; $prim[$i] = $chif[$unite[$i] + 10];
1208 1208
             }
1209 1209
         }
1210
-        else if($dix[$i]==8)
1210
+        else if ($dix[$i] == 8)
1211 1211
         {
1212
-            if($unite[$i]==1)
1212
+            if ($unite[$i] == 1)
1213 1213
             {
1214
-                $secon[$i]='quatre-vingts et'; $prim[$i]=$chif[$unite[$i]];
1214
+                $secon[$i] = 'quatre-vingts et'; $prim[$i] = $chif[$unite[$i]];
1215 1215
             }
1216 1216
             else {
1217
-                $secon[$i]='quatre-vingt'; $prim[$i]=$chif[$unite[$i]];
1217
+                $secon[$i] = 'quatre-vingt'; $prim[$i] = $chif[$unite[$i]];
1218 1218
             }
1219 1219
         }
1220
-        else if($dix[$i]==9)
1220
+        else if ($dix[$i] == 9)
1221 1221
         {
1222
-            if($unite[$i]==1) {
1223
-                $secon[$i]='quatre-vingts et'; $prim[$i]=$chif[$unite[$i]+10];
1222
+            if ($unite[$i] == 1) {
1223
+                $secon[$i] = 'quatre-vingts et'; $prim[$i] = $chif[$unite[$i] + 10];
1224 1224
             }
1225 1225
             else {
1226
-                $secon[$i]='quatre-vingts'; $prim[$i]=$chif[$unite[$i]+10];
1226
+                $secon[$i] = 'quatre-vingts'; $prim[$i] = $chif[$unite[$i] + 10];
1227 1227
             }
1228 1228
         }
1229 1229
 
1230
-        if($cent[$i]==1) {
1231
-            $trio[$i]='cent';
1230
+        if ($cent[$i] == 1) {
1231
+            $trio[$i] = 'cent';
1232 1232
         }
1233
-        else if($cent[$i]!=0 || $cent[$i]!='') {
1234
-            $trio[$i] = $chif[$cent[$i]] .' cents';
1233
+        else if ($cent[$i] != 0 || $cent[$i] != '') {
1234
+            $trio[$i] = $chif[$cent[$i]] . ' cents';
1235 1235
         }
1236 1236
     }
1237 1237
 
1238 1238
 
1239
-    $chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix');
1239
+    $chif2 = array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix');
1240 1240
 
1241
-    $secon_c=$chif2[$dix_c];
1242
-    if($cent_c==1) {
1243
-        $trio_c='cent';
1241
+    $secon_c = $chif2[$dix_c];
1242
+    if ($cent_c == 1) {
1243
+        $trio_c = 'cent';
1244 1244
     }
1245
-    else if($cent_c!=0 || $cent_c!='') {
1246
-        $trio_c = $chif[$cent_c] .' cents';
1245
+    else if ($cent_c != 0 || $cent_c != '') {
1246
+        $trio_c = $chif[$cent_c] . ' cents';
1247 1247
     }
1248 1248
 
1249 1249
 
1250
-    if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1)) {
1251
-        $return .= $trio[3]. '  ' .$secon[3]. ' ' . $prim[3]. ' million ';
1250
+    if (($cent[3] == 0 || $cent[3] == '') && ($dix[3] == 0 || $dix[3] == '') && ($unite[3] == 1)) {
1251
+        $return .= $trio[3] . '  ' . $secon[3] . ' ' . $prim[3] . ' million ';
1252 1252
     }
1253
-    else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!='')) {
1254
-        $return .= $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions ';
1253
+    else if (($cent[3] != 0 && $cent[3] != '') || ($dix[3] != 0 && $dix[3] != '') || ($unite[3] != 0 && $unite[3] != '')) {
1254
+        $return .= $trio[3] . ' ' . $secon[3] . ' ' . $prim[3] . ' millions ';
1255 1255
     }
1256 1256
     else {
1257
-        $return .= $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
1257
+        $return .= $trio[3] . ' ' . $secon[3] . ' ' . $prim[3];
1258 1258
     }
1259 1259
 
1260
-    if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1)) {
1260
+    if (($cent[2] == 0 || $cent[2] == '') && ($dix[2] == 0 || $dix[2] == '') && ($unite[2] == 1)) {
1261 1261
         $return .= ' mille ';
1262 1262
     }
1263
-    else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!='')) {
1264
-        $return .= $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles ';
1263
+    else if (($cent[2] != 0 && $cent[2] != '') || ($dix[2] != 0 && $dix[2] != '') || ($unite[2] != 0 && $unite[2] != '')) {
1264
+        $return .= $trio[2] . ' ' . $secon[2] . ' ' . $prim[2] . ' milles ';
1265 1265
     }
1266 1266
     else {
1267
-        $return .= $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
1267
+        $return .= $trio[2] . ' ' . $secon[2] . ' ' . $prim[2];
1268 1268
     }
1269 1269
 
1270
-    $return .= $trio[1]. ' ' .$secon[1]. ' ' . $prim[1];
1270
+    $return .= $trio[1] . ' ' . $secon[1] . ' ' . $prim[1];
1271 1271
 
1272 1272
 
1273
-    if(!($cent_c=='0' || $cent_c=='') || !($dix_c=='0' || $dix_c=='')) {
1274
-        $return .= $trio_c. ' ' .$secon_c;
1273
+    if (!($cent_c == '0' || $cent_c == '') || !($dix_c == '0' || $dix_c == '')) {
1274
+        $return .= $trio_c . ' ' . $secon_c;
1275 1275
     }
1276 1276
 
1277 1277
     return trim($return);
Please login to merge, or discard this patch.
Braces   +36 added lines, -62 removed lines patch added patch discarded remove patch
@@ -148,16 +148,20 @@  discard block
 block discarded – undo
148 148
     --  NB: ne pas confondre $extensions et $extension. l'un représente les différents extension autorisés et
149 149
         l'autre vérifie si l'extension originale du fichier doit être modifié ou non
150 150
     */
151
-    if (empty($output)) // Si on ne defini pas le nom de sortie...
151
+    if (empty($output)) {
152
+        // Si on ne defini pas le nom de sortie...
152 153
     {
153 154
         // on enregistre le fichier avec la date et l'heure courante
154 155
         $output = 'scl_' . date('Ymd') . '-' . date('His');
156
+    }
155 157
         $extension = '0.';
156 158
     } else // Si on defini le nom de sortie...
157 159
     {
158
-        if (!empty(explode('.', $output)[1]) AND in_array(strtolower(explode('.', $output)[1]), $extensions))  // Si l'extension est presente dans ce nom et est valide...
160
+        if (!empty(explode('.', $output)[1]) AND in_array(strtolower(explode('.', $output)[1]), $extensions)) {
161
+            // Si l'extension est presente dans ce nom et est valide...
159 162
         {
160 163
             $out = explode('.', $output);
164
+        }
161 165
             $output = $out[0]; // On enregistre le fichier avec le nom specifié
162 166
             $extension = '1.' . $out[1]; // On enregistre le fichier avec l'extension specifié (changement d'extension)
163 167
         } else // Sinon...on enregistre le fichier avec le nom specifié mais en conservant son extension
@@ -782,8 +786,7 @@  discard block
 block discarded – undo
782 786
     if (is_file($file) AND file_exists($file)) {
783 787
         extract((array)$data);
784 788
         include_once($file);
785
-    }
786
-    else if ($exception) {
789
+    } else if ($exception) {
787 790
         die('SCL EXCEPTION : The file &laquo; <b>' . $file . '</b> &raquo; don\'t exist !');
788 791
     }
789 792
     return;
@@ -840,20 +843,16 @@  discard block
 block discarded – undo
840 843
 
841 844
         if(is_null($var)) {
842 845
             echo "\n\tNULL";
843
-        }
844
-        else if(is_string($var) OR is_numeric($var))
846
+        } else if(is_string($var) OR is_numeric($var))
845 847
         {
846 848
             echo "\n\t".$var;
847
-        }
848
-        else if(is_bool($var)) {
849
+        } else if(is_bool($var)) {
849 850
             echo (true === $var) ? "\n\ttrue" : "\n\tfalse";
850
-        }
851
-        else if(is_array($var) OR is_object($var))
851
+        } else if(is_array($var) OR is_object($var))
852 852
         {
853 853
             if(empty($var)) {
854 854
                 echo "\n\tempty";
855
-            }
856
-            else
855
+            } else
857 856
             {
858 857
                 foreach($var As $key => $value)
859 858
                 {
@@ -861,12 +860,10 @@  discard block
 block discarded – undo
861 860
                     echo "<b>".$key."</b> => ";
862 861
                     if(is_array($value) OR is_object($value)) {
863 862
                         scl_debug($value);
864
-                    }
865
-                    else {
863
+                    } else {
866 864
                         if(is_bool($value)) {
867 865
                             echo (true === $value) ? 'true' : 'false';
868
-                        }
869
-                        else {
866
+                        } else {
870 867
                             echo $value;
871 868
                         }
872 869
                         echo '<span style="auto;font-weight:lighter !important; display:inline-block; padding-left:.5em; color:#eb7c55">['.ucfirst(gettype($value));
@@ -1149,88 +1146,70 @@  discard block
 block discarded – undo
1149 1146
 
1150 1147
         if($dix[$i]==0) {
1151 1148
             $secon[$i]=''; $prim[$i]=$chif[$unite[$i]];
1152
-        }
1153
-        else if($dix[$i]==1) {
1149
+        } else if($dix[$i]==1) {
1154 1150
             $secon[$i]=''; $prim[$i]=$chif[($unite[$i]+10)];
1155
-        }
1156
-        else if($dix[$i]==2)
1151
+        } else if($dix[$i]==2)
1157 1152
         {
1158 1153
             if($unite[$i]==1) {
1159 1154
                 $secon[$i]='vingt et'; $prim[$i]=$chif[$unite[$i]];
1160
-            }
1161
-            else {
1155
+            } else {
1162 1156
                 $secon[$i]='vingt'; $prim[$i]=$chif[$unite[$i]];
1163 1157
             }
1164
-        }
1165
-        else if($dix[$i]==3)
1158
+        } else if($dix[$i]==3)
1166 1159
         {
1167 1160
             if($unite[$i]==1) {
1168 1161
                 $secon[$i]='trente et'; $prim[$i]=$chif[$unite[$i]];
1169
-            }
1170
-            else {
1162
+            } else {
1171 1163
                 $secon[$i]='trente'; $prim[$i]=$chif[$unite[$i]];
1172 1164
             }
1173
-        }
1174
-        else if($dix[$i]==4)
1165
+        } else if($dix[$i]==4)
1175 1166
         {
1176 1167
             if($unite[$i]==1) {
1177 1168
                 $secon[$i]='quarante et'; $prim[$i]=$chif[$unite[$i]];
1178
-            }
1179
-            else {
1169
+            } else {
1180 1170
                 $secon[$i]='quarante'; $prim[$i]=$chif[$unite[$i]];
1181 1171
             }
1182
-        }
1183
-        else if($dix[$i]==5)
1172
+        } else if($dix[$i]==5)
1184 1173
         {
1185 1174
             if($unite[$i]==1) {
1186 1175
                 $secon[$i]='cinquante et'; $prim[$i]=$chif[$unite[$i]];
1187
-            }
1188
-            else {
1176
+            } else {
1189 1177
                 $secon[$i]='cinquante'; $prim[$i]=$chif[$unite[$i]];
1190 1178
             }
1191
-        }
1192
-        else if($dix[$i]==6)
1179
+        } else if($dix[$i]==6)
1193 1180
         {
1194 1181
             if($unite[$i]==1) {
1195 1182
                 $secon[$i]='soixante et'; $prim[$i]=$chif[$unite[$i]];
1196
-            }
1197
-            else {
1183
+            } else {
1198 1184
                 $secon[$i]='soixante'; $prim[$i]=$chif[$unite[$i]];
1199 1185
             }
1200
-        }
1201
-        else if($dix[$i]==7)
1186
+        } else if($dix[$i]==7)
1202 1187
         {
1203 1188
             if($unite[$i]==1) {
1204 1189
                 $secon[$i]='soixante et'; $prim[$i]=$chif[$unite[$i]+10];
1205
-            }
1206
-            else {
1190
+            } else {
1207 1191
                 $secon[$i]='soixante'; $prim[$i]=$chif[$unite[$i]+10];
1208 1192
             }
1209
-        }
1210
-        else if($dix[$i]==8)
1193
+        } else if($dix[$i]==8)
1211 1194
         {
1212 1195
             if($unite[$i]==1)
1213 1196
             {
1214 1197
                 $secon[$i]='quatre-vingts et'; $prim[$i]=$chif[$unite[$i]];
1215
-            }
1216
-            else {
1198
+            } else {
1217 1199
                 $secon[$i]='quatre-vingt'; $prim[$i]=$chif[$unite[$i]];
1218 1200
             }
1219
-        }
1220
-        else if($dix[$i]==9)
1201
+        } else if($dix[$i]==9)
1221 1202
         {
1222 1203
             if($unite[$i]==1) {
1223 1204
                 $secon[$i]='quatre-vingts et'; $prim[$i]=$chif[$unite[$i]+10];
1224
-            }
1225
-            else {
1205
+            } else {
1226 1206
                 $secon[$i]='quatre-vingts'; $prim[$i]=$chif[$unite[$i]+10];
1227 1207
             }
1228 1208
         }
1229 1209
 
1230 1210
         if($cent[$i]==1) {
1231 1211
             $trio[$i]='cent';
1232
-        }
1233
-        else if($cent[$i]!=0 || $cent[$i]!='') {
1212
+        } else if($cent[$i]!=0 || $cent[$i]!='') {
1234 1213
             $trio[$i] = $chif[$cent[$i]] .' cents';
1235 1214
         }
1236 1215
     }
@@ -1241,29 +1220,24 @@  discard block
 block discarded – undo
1241 1220
     $secon_c=$chif2[$dix_c];
1242 1221
     if($cent_c==1) {
1243 1222
         $trio_c='cent';
1244
-    }
1245
-    else if($cent_c!=0 || $cent_c!='') {
1223
+    } else if($cent_c!=0 || $cent_c!='') {
1246 1224
         $trio_c = $chif[$cent_c] .' cents';
1247 1225
     }
1248 1226
 
1249 1227
 
1250 1228
     if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1)) {
1251 1229
         $return .= $trio[3]. '  ' .$secon[3]. ' ' . $prim[3]. ' million ';
1252
-    }
1253
-    else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!='')) {
1230
+    } else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!='')) {
1254 1231
         $return .= $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions ';
1255
-    }
1256
-    else {
1232
+    } else {
1257 1233
         $return .= $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
1258 1234
     }
1259 1235
 
1260 1236
     if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1)) {
1261 1237
         $return .= ' mille ';
1262
-    }
1263
-    else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!='')) {
1238
+    } else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!='')) {
1264 1239
         $return .= $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles ';
1265
-    }
1266
-    else {
1240
+    } else {
1267 1241
         $return .= $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
1268 1242
     }
1269 1243
 
Please login to merge, or discard this patch.