GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( ca9c18...0a41a9 )
by Steeven
01:58
created
src/Helpers/Text.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 // ------------------------------------------------------------------------
12 12
 
13
-if ( ! function_exists('text_split')) {
13
+if (!function_exists('text_split')) {
14 14
     /**
15 15
      * text_split
16 16
      *
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
     function text_split($text, $splitter = '<---text-split--->', $limit = 100)
28 28
     {
29 29
         $wrap_text = wordwrap($text, $limit, $splitter);
30
-        $wrap_text = preg_split('[' . $splitter . ']', $wrap_text, -1, PREG_SPLIT_NO_EMPTY);
30
+        $wrap_text = preg_split('['.$splitter.']', $wrap_text, -1, PREG_SPLIT_NO_EMPTY);
31 31
 
32 32
         return implode('', $wrap_text);
33 33
     }
34 34
 }
35 35
 // ------------------------------------------------------------------------
36 36
 
37
-if ( ! function_exists('text_columns')) {
37
+if (!function_exists('text_columns')) {
38 38
     /**
39 39
      * text_columns
40 40
      *
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
         $return = explode("\n", wordwrap(strrev($text), $col_length));
52 52
 
53 53
         if (count($return) > $cols) {
54
-            $return[ $cols - 1 ] .= " " . $return[ $cols ];
55
-            unset($return[ $cols ]);
54
+            $return[$cols - 1] .= " ".$return[$cols];
55
+            unset($return[$cols]);
56 56
         }
57 57
 
58 58
         $return = array_map("strrev", $return);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 }
63 63
 // ------------------------------------------------------------------------
64 64
 
65
-if ( ! function_exists('text_wrap')) {
65
+if (!function_exists('text_wrap')) {
66 66
     /**
67 67
      * text_wrap
68 68
      *
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     function text_wrap($text, $chars = 10, $lines = false)
78 78
     {
79 79
         # the simple case - return wrapped words
80
-        if ( ! $lines) {
80
+        if (!$lines) {
81 81
             return wordwrap($text, $chars, "\n");
82 82
         }
83 83
         # truncate to maximum possible number of characters
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
         $return = wordwrap($return, $chars, "\n");
87 87
         preg_match("/(.+\n?){0,$lines}/", $return, $regs);
88 88
 
89
-        return $regs[ 0 ];
89
+        return $regs[0];
90 90
     }
91 91
 }
92 92
 // ------------------------------------------------------------------------
93 93
 
94
-if ( ! function_exists('text_trim')) {
94
+if (!function_exists('text_trim')) {
95 95
     /**
96 96
      * Cuts the given string to a certain length without breaking a word.
97 97
      *
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         // is $break present between $limit and the end of the string?
112 112
         if (false !== ($breakpoint = strpos($text, $break, $limit))) {
113 113
             if ($breakpoint < strlen($text) - 1) {
114
-                $text = substr($text, 0, $breakpoint) . $ending;
114
+                $text = substr($text, 0, $breakpoint).$ending;
115 115
             }
116 116
         }
117 117
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 // ------------------------------------------------------------------------
123 123
 
124
-if ( ! function_exists('text_word_limiter')) {
124
+if (!function_exists('text_word_limiter')) {
125 125
     /**
126 126
      * text_word_limiter
127 127
      *
@@ -139,19 +139,19 @@  discard block
 block discarded – undo
139 139
             return $str;
140 140
         }
141 141
 
142
-        preg_match('/^\s*+(?:\S++\s*+){1,' . (int)$limit . '}/', $str, $matches);
142
+        preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches);
143 143
 
144
-        if (strlen($str) === strlen($matches[ 0 ])) {
144
+        if (strlen($str) === strlen($matches[0])) {
145 145
             $end_char = '';
146 146
         }
147 147
 
148
-        return rtrim($matches[ 0 ]) . $end_char;
148
+        return rtrim($matches[0]).$end_char;
149 149
     }
150 150
 }
151 151
 
152 152
 // ------------------------------------------------------------------------
153 153
 
154
-if ( ! function_exists('text_character_limiter')) {
154
+if (!function_exists('text_character_limiter')) {
155 155
     /**
156 156
      * text_character_limiter
157 157
      *
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 
180 180
         $out = '';
181 181
         foreach (explode(' ', trim($string)) as $val) {
182
-            $out .= $val . ' ';
182
+            $out .= $val.' ';
183 183
 
184 184
             if (mb_strlen($out) >= $n) {
185 185
                 $out = trim($out);
186 186
 
187
-                return (mb_strlen($out) === mb_strlen($string)) ? $out : $out . $end_char;
187
+                return (mb_strlen($out) === mb_strlen($string)) ? $out : $out.$end_char;
188 188
             }
189 189
         }
190 190
     }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 // ------------------------------------------------------------------------
194 194
 
195
-if ( ! function_exists('text_censored')) {
195
+if (!function_exists('text_censored')) {
196 196
     /**
197 197
      * text_censored
198 198
      *
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
      */
209 209
     function text_censored($string, $censored, $replacement = '')
210 210
     {
211
-        if ( ! is_array($censored)) {
211
+        if (!is_array($censored)) {
212 212
             return $string;
213 213
         }
214 214
 
215
-        $string = ' ' . $string . ' ';
215
+        $string = ' '.$string.' ';
216 216
 
217 217
         // \w, \b and a few others do not match on a unicode character
218 218
         // set for performance reasons. As a result words like �ber
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
         foreach ($censored as $badword) {
224 224
             if ($replacement !== '') {
225 225
                 $string = preg_replace(
226
-                    "/({$delim})(" . str_replace('\*', '\w*?', preg_quote($badword, '/')) . ")({$delim})/i",
226
+                    "/({$delim})(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")({$delim})/i",
227 227
                     "\\1{$replacement}\\3",
228 228
                     $string
229 229
                 );
230 230
             } else {
231 231
                 $string = preg_replace(
232
-                    "/({$delim})(" . str_replace('\*', '\w*?', preg_quote($badword, '/')) . ")({$delim})/ie",
232
+                    "/({$delim})(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")({$delim})/ie",
233 233
                     "'\\1'.str_repeat('#', strlen('\\2')).'\\3'",
234 234
                     $string
235 235
                 );
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 // ------------------------------------------------------------------------
244 244
 
245
-if ( ! function_exists('text_highlight_phrase')) {
245
+if (!function_exists('text_highlight_phrase')) {
246 246
     /**
247 247
      * text_highlight_phrase
248 248
      *
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
     {
260 260
         return ($string !== '' && $phrase !== '')
261 261
             ? preg_replace(
262
-                '/(' . preg_quote($phrase, '/') . ')/i' . ('UTF8_ENABLED' ? 'u' : ''),
263
-                $tag_open . '\\1' . $tag_close,
262
+                '/('.preg_quote($phrase, '/').')/i'.('UTF8_ENABLED' ? 'u' : ''),
263
+                $tag_open.'\\1'.$tag_close,
264 264
                 $string
265 265
             )
266 266
             : $string;
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
 // ------------------------------------------------------------------------
271 271
 
272
-if ( ! function_exists('text_word_wrap')) {
272
+if (!function_exists('text_word_wrap')) {
273 273
     /**
274 274
      * text_word_wrap
275 275
      *
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
         // strip the entire chunk and replace it with a marker.
300 300
         $unwrap = [];
301 301
         if (preg_match_all('|\{unwrap\}(.+?)\{/unwrap\}|s', $string, $matches)) {
302
-            for ($i = 0, $c = count($matches[ 0 ]); $i < $c; $i++) {
303
-                $unwrap[] = $matches[ 1 ][ $i ];
304
-                $string = str_replace($matches[ 0 ][ $i ], '{{unwrapped' . $i . '}}', $string);
302
+            for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
303
+                $unwrap[] = $matches[1][$i];
304
+                $string = str_replace($matches[0][$i], '{{unwrapped'.$i.'}}', $string);
305 305
             }
306 306
         }
307 307
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             // Is the line within the allowed character count?
317 317
             // If so we'll join it to the output and continue
318 318
             if (mb_strlen($line) <= $limit) {
319
-                $output .= $line . "\n";
319
+                $output .= $line."\n";
320 320
                 continue;
321 321
             }
322 322
 
@@ -335,16 +335,16 @@  discard block
 block discarded – undo
335 335
             // If $temp contains data it means we had to split up an over-length
336 336
             // word into smaller chunks so we'll add it back to our current line
337 337
             if ($temp !== '') {
338
-                $output .= $temp . "\n" . $line . "\n";
338
+                $output .= $temp."\n".$line."\n";
339 339
             } else {
340
-                $output .= $line . "\n";
340
+                $output .= $line."\n";
341 341
             }
342 342
         }
343 343
 
344 344
         // Put our markers back
345 345
         if (count($unwrap) > 0) {
346 346
             foreach ($unwrap as $key => $val) {
347
-                $output = str_replace('{{unwrapped' . $key . '}}', $val, $output);
347
+                $output = str_replace('{{unwrapped'.$key.'}}', $val, $output);
348 348
             }
349 349
         }
350 350
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 
355 355
 // ------------------------------------------------------------------------
356 356
 
357
-if ( ! function_exists('text_ellipsis')) {
357
+if (!function_exists('text_ellipsis')) {
358 358
     /**
359 359
      * text_ellipsis
360 360
      *
@@ -386,13 +386,13 @@  discard block
 block discarded – undo
386 386
             $end = mb_substr($string, -($max_length - mb_strlen($beg)));
387 387
         }
388 388
 
389
-        return $beg . $ellipsis . $end;
389
+        return $beg.$ellipsis.$end;
390 390
     }
391 391
 }
392 392
 
393 393
 // ------------------------------------------------------------------------
394 394
 
395
-if ( ! function_exists('text_excerpt')) {
395
+if (!function_exists('text_excerpt')) {
396 396
     /**
397 397
      * text_excerpt
398 398
      *
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         if (isset($phrase)) {
414 414
             $phrase_pos = strpos(strtolower($string), strtolower($phrase));
415 415
             $phrase_len = strlen($phrase);
416
-        } elseif ( ! isset($phrase)) {
416
+        } elseif (!isset($phrase)) {
417 417
             $phrase_pos = $radius / 2;
418 418
             $phrase_len = 1;
419 419
         }
@@ -424,19 +424,19 @@  discard block
 block discarded – undo
424 424
         $count = 0;
425 425
         foreach (array_reverse($pre) as $pr => $e) {
426 426
             if ((strlen($e) + $count + 1) < $radius) {
427
-                $prev = ' ' . $e . $prev;
427
+                $prev = ' '.$e.$prev;
428 428
             }
429 429
             $count = ++$count + strlen($e);
430 430
         }
431 431
         $count = 0;
432 432
         foreach ($pos as $po => $s) {
433 433
             if ((strlen($s) + $count + 1) < $radius) {
434
-                $post .= $s . ' ';
434
+                $post .= $s.' ';
435 435
             }
436 436
             $count = ++$count + strlen($s);
437 437
         }
438 438
         $ellPre = $phrase ? $ellipsis : '';
439 439
 
440
-        return $ellPre . $prev . $phrase . $post . $ellipsis;
440
+        return $ellPre.$prev.$phrase.$post.$ellipsis;
441 441
     }
442 442
 }
443 443
\ No newline at end of file
Please login to merge, or discard this patch.
src/Helpers/Array.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * A collection of helper function to work with array.
16 16
  */
17 17
 // ------------------------------------------------------------------------
18
-if ( ! function_exists('array_get_value')) {
18
+if (!function_exists('array_get_value')) {
19 19
     /**
20 20
      * array_get_value
21 21
      *
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
      */
31 31
     function array_get_value($key, array $array, $default = null)
32 32
     {
33
-        return array_key_exists($key, $array) ? $array[ $key ] : $default;
33
+        return array_key_exists($key, $array) ? $array[$key] : $default;
34 34
     }
35 35
 }
36 36
 
37 37
 // ------------------------------------------------------------------------
38 38
 
39
-if ( ! function_exists('array_get_values')) {
39
+if (!function_exists('array_get_values')) {
40 40
     /**
41 41
      * array_get_values
42 42
      *
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 
58 58
         foreach ($keys as $item) {
59 59
             if (array_key_exists($item, $array)) {
60
-                $return[ $item ] = $array[ $item ];
60
+                $return[$item] = $array[$item];
61 61
             } elseif (is_array($default) && array_key_exists($item, $default)) {
62
-                $return[ $item ] = $default[ $item ];
63
-            } elseif ( ! empty($default)) {
64
-                $return[ $item ] = $default;
62
+                $return[$item] = $default[$item];
63
+            } elseif (!empty($default)) {
64
+                $return[$item] = $default;
65 65
             }
66 66
         }
67 67
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 // ------------------------------------------------------------------------
74 74
 
75
-if ( ! function_exists('array_combines')) {
75
+if (!function_exists('array_combines')) {
76 76
     /**
77 77
      * array_combines
78 78
      *
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
         $combine_array = [];
89 89
 
90 90
         foreach ($keys as $index => $key) {
91
-            $combine_array[ $key ][] = $values[ $index ];
91
+            $combine_array[$key][] = $values[$index];
92 92
         }
93 93
 
94 94
         array_walk(
95 95
             $combine_array,
96
-            function (&$value) {
96
+            function(&$value) {
97 97
                 $value = (count($value) == 1) ? array_pop($value) : $value;
98 98
             }
99 99
         );
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 // ------------------------------------------------------------------------
106 106
 
107
-if ( ! function_exists('array_group')) {
107
+if (!function_exists('array_group')) {
108 108
     /**
109 109
      * array_group
110 110
      *
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
         if ($flip) {
123 123
             array_walk_recursive(
124 124
                 $array,
125
-                function ($value, $key) use (&$group_array) {
126
-                    if ( ! isset($group_array[ $value ]) || ! is_array($group_array[ $value ])) {
127
-                        $group_array[ $value ] = [];
125
+                function($value, $key) use (&$group_array) {
126
+                    if (!isset($group_array[$value]) || !is_array($group_array[$value])) {
127
+                        $group_array[$value] = [];
128 128
                     }
129
-                    $group_array[ $value ][] = $key;
129
+                    $group_array[$value][] = $key;
130 130
                 }
131 131
             );
132 132
         } else {
133 133
             array_walk_recursive(
134 134
                 $array,
135
-                function ($value, $key) use (&$group_array) {
136
-                    $group_array[ $key ][] = $value;
135
+                function($value, $key) use (&$group_array) {
136
+                    $group_array[$key][] = $value;
137 137
                 }
138 138
             );
139 139
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     }
143 143
 }
144 144
 
145
-if ( ! function_exists('array_filter_recursive')) {
145
+if (!function_exists('array_filter_recursive')) {
146 146
     /**
147 147
      * array_filter_recursive
148 148
      *
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
             if ($count > 0 and $count == $limit) {
172 172
                 return $result;
173 173
             }
174
-            if ( ! is_array($value)) {
174
+            if (!is_array($value)) {
175 175
                 if ($key != $value) {
176
-                    $result[ $key ] = $value;
176
+                    $result[$key] = $value;
177 177
                     $count++;
178 178
                 }
179 179
             } else {
180 180
                 $sub = array_filter_recursive($value, $value, $limit);
181 181
                 if (count($sub) > 0) {
182 182
                     if ($key != $value) {
183
-                        $result[ $key ] = $sub;
183
+                        $result[$key] = $sub;
184 184
                         $count += count($sub);
185 185
                     }
186 186
                 }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
 // ------------------------------------------------------------------------
195 195
 
196
-if ( ! function_exists('array_search_recursive')) {
196
+if (!function_exists('array_search_recursive')) {
197 197
     /**
198 198
      * array_search_recursive
199 199
      *
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             if ($strict === false) {
213 213
                 $needle = strtolower($needle);
214 214
 
215
-                if ( ! is_array($value)) {
215
+                if (!is_array($value)) {
216 216
                     $value = strtolower($value);
217 217
                 } else {
218 218
                     $value = array_map('strtolower', $value);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 // ------------------------------------------------------------------------
238 238
 
239
-if ( ! function_exists('array_unique_recursive')) {
239
+if (!function_exists('array_unique_recursive')) {
240 240
     /**
241 241
      * array_unique_recursive
242 242
      *
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
 // ------------------------------------------------------------------------
259 259
 
260
-if ( ! function_exists('array_flatten')) {
260
+if (!function_exists('array_flatten')) {
261 261
     /**
262 262
      * array_flatten
263 263
      *
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             if (is_array($value)) {
276 276
                 $flat_array = array_merge($flat_array, array_flatten($value));
277 277
             } else {
278
-                $flat_array[ $key ] = $value;
278
+                $flat_array[$key] = $value;
279 279
             }
280 280
         }
281 281
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
 // ------------------------------------------------------------------------
287 287
 
288
-if ( ! function_exists('range_price')) {
288
+if (!function_exists('range_price')) {
289 289
     /**
290 290
      * range_price
291 291
      *
@@ -314,10 +314,10 @@  discard block
 block discarded – undo
314 314
 
315 315
         $prices = [];
316 316
         for ($i = 0; $i < count($ranges); $i++) {
317
-            if ($ranges[ $i ] == $max) {
317
+            if ($ranges[$i] == $max) {
318 318
                 break;
319 319
             } else {
320
-                $prices[ $ranges[ $i ] ] = ($ranges[ $i + 1 ] == 0) ? $ranges[ $i ] * 2 : $ranges[ $i + 1 ];
320
+                $prices[$ranges[$i]] = ($ranges[$i + 1] == 0) ? $ranges[$i] * 2 : $ranges[$i + 1];
321 321
             }
322 322
         }
323 323
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 // ------------------------------------------------------------------------
329 329
 
330 330
 
331
-if ( ! function_exists('range_date')) {
331
+if (!function_exists('range_date')) {
332 332
     /**
333 333
      * range_date
334 334
      *
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 
346 346
         $date_range = [];
347 347
         for ($i = 0; $i < $days; $i++) {
348
-            $date_range[ $i ] = $start_date + ($i * 24 * 60 * 60);
348
+            $date_range[$i] = $start_date + ($i * 24 * 60 * 60);
349 349
         }
350 350
 
351 351
         return $date_range;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 }
354 354
 // ------------------------------------------------------------------------
355 355
 
356
-if ( ! function_exists('range_year')) {
356
+if (!function_exists('range_year')) {
357 357
     /**
358 358
      * range_year
359 359
      *
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $years = [];
373 373
 
374 374
         foreach (range($min, $max, $step) as $year) {
375
-            $years[ $year ] = $year;
375
+            $years[$year] = $year;
376 376
         }
377 377
 
378 378
         return $years;
Please login to merge, or discard this patch.
src/Helpers/String.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 // ------------------------------------------------------------------------
12 12
 
13
-if ( ! function_exists('str_echo')) {
13
+if (!function_exists('str_echo')) {
14 14
     /**
15 15
      * str_echo
16 16
      *
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     function str_echo($string, $prefix = null, $suffix = null, $glue = '')
27 27
     {
28
-        if ( ! empty($string) OR $string !== '') {
28
+        if (!empty($string) OR $string !== '') {
29 29
             return implode($glue, array_filter([
30 30
                 $prefix,
31 31
                 $string,
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 // ------------------------------------------------------------------------
41 41
 
42
-if ( ! function_exists('str_email')) {
42
+if (!function_exists('str_email')) {
43 43
     /**
44 44
      * str_email
45 45
      *
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     function str_email($string)
53 53
     {
54
-        if ( ! empty($string) or $string != '') {
54
+        if (!empty($string) or $string != '') {
55 55
             return str_replace(
56 56
                 [
57 57
                     '.',
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 // ------------------------------------------------------------------------
73 73
 
74
-if ( ! function_exists('str_alphanumeric')) {
74
+if (!function_exists('str_alphanumeric')) {
75 75
     /**
76 76
      * str_alphanumeric
77 77
      *
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     function str_alphanumeric($string)
86 86
     {
87
-        if ( ! empty($string) or $string != '') {
87
+        if (!empty($string) or $string != '') {
88 88
             $string = preg_replace("/[^a-zA-Z0-9\s]/", "", $string);
89 89
         }
90 90
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 // ------------------------------------------------------------------------
96 96
 
97
-if ( ! function_exists('str_numeric')) {
97
+if (!function_exists('str_numeric')) {
98 98
     /**
99 99
      * str_numeric
100 100
      *
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     function str_numeric($string)
111 111
     {
112
-        if ( ! empty($string) or $string != '') {
112
+        if (!empty($string) or $string != '') {
113 113
             $string = preg_replace("/[^0-9\s]/", "", $string);
114 114
         }
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 // ------------------------------------------------------------------------
121 121
 
122
-if ( ! function_exists('str_truncate')) {
122
+if (!function_exists('str_truncate')) {
123 123
     /**
124 124
      * str_truncate
125 125
      *
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             $string = strip_tags($string);
138 138
             $string = substr($string, 0, $limit);
139 139
             $string = substr($string, 0, -(strlen(strrchr($string, ' '))));
140
-            $string = $string . $ending;
140
+            $string = $string.$ending;
141 141
         }
142 142
 
143 143
         return $string;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 // ------------------------------------------------------------------------
148 148
 
149
-if ( ! function_exists('str_shorten')) {
149
+if (!function_exists('str_shorten')) {
150 150
     /**
151 151
      * str_shorten
152 152
      *
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         if (strlen($string) > $limit) {
164 164
             $prefix = substr($string, 0, ($limit / 2));
165 165
             $suffix = substr($string, -($limit / 2));
166
-            $string = $prefix . ' ... ' . $suffix;
166
+            $string = $prefix.' ... '.$suffix;
167 167
         }
168 168
 
169 169
         return $string;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 // ------------------------------------------------------------------------
174 174
 
175
-if ( ! function_exists('str_obfuscate')) {
175
+if (!function_exists('str_obfuscate')) {
176 176
     /**
177 177
      * str_obfuscate
178 178
      *
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $length = strlen($string);
188 188
         $scrambled = '';
189 189
         for ($i = 0; $i < $length; ++$i) {
190
-            $scrambled .= '&#' . ord(substr($string, $i, 1)) . ';';
190
+            $scrambled .= '&#'.ord(substr($string, $i, 1)).';';
191 191
         }
192 192
 
193 193
         return $scrambled;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 // ------------------------------------------------------------------------
198 198
 
199
-if ( ! function_exists('str_symbol_to_entities')) {
199
+if (!function_exists('str_symbol_to_entities')) {
200 200
 
201 201
     /**
202 202
      * str_symbol_to_entities
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
 // ------------------------------------------------------------------------
466 466
 
467
-if ( ! function_exists('str_strip_slashes')) {
467
+if (!function_exists('str_strip_slashes')) {
468 468
     /**
469 469
      * str_strip_slashes
470 470
      *
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
      */
477 477
     function str_strip_slashes($string)
478 478
     {
479
-        if ( ! is_array($string)) {
479
+        if (!is_array($string)) {
480 480
             return stripslashes($string);
481 481
         }
482 482
 
483 483
         foreach ($string as $key => $val) {
484
-            $string[ $key ] = str_strip_slashes($val);
484
+            $string[$key] = str_strip_slashes($val);
485 485
         }
486 486
 
487 487
         return $string;
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
 // ------------------------------------------------------------------------
492 492
 
493
-if ( ! function_exists('str_quote_strip')) {
493
+if (!function_exists('str_quote_strip')) {
494 494
     /**
495 495
      * str_quote_strip
496 496
      *
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 
509 509
 // ------------------------------------------------------------------------
510 510
 
511
-if ( ! function_exists('str_quote_to_entities')) {
511
+if (!function_exists('str_quote_to_entities')) {
512 512
     /**
513 513
      * str_quote_to_entities
514 514
      *
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 // ------------------------------------------------------------------------
528 528
 
529 529
 
530
-if ( ! function_exists('str_filter_char')) {
530
+if (!function_exists('str_filter_char')) {
531 531
     /**
532 532
      * str_filter_char
533 533
      *
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
      */
548 548
     function str_filter_char($str, $character = ',', $trim = false)
549 549
     {
550
-        $str = preg_replace('#' . preg_quote($character, '#') . '{2,}#', $character, $str);
550
+        $str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str);
551 551
 
552 552
         return ($trim === true) ? trim($str, $character) : $str;
553 553
     }
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 
556 556
 // ------------------------------------------------------------------------
557 557
 
558
-if ( ! function_exists('str_rand')) {
558
+if (!function_exists('str_rand')) {
559 559
     /**
560 560
      * str_rand
561 561
      *
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 
605 605
 // ------------------------------------------------------------------------
606 606
 
607
-if ( ! function_exists('str_inc')) {
607
+if (!function_exists('str_inc')) {
608 608
     /**
609 609
      * str_inc
610 610
      *
@@ -618,15 +618,15 @@  discard block
 block discarded – undo
618 618
      */
619 619
     function str_inc($string, $separator = '_', $first = 1)
620 620
     {
621
-        preg_match('/(.+)' . $separator . '([0-9]+)$/', $string, $match);
621
+        preg_match('/(.+)'.$separator.'([0-9]+)$/', $string, $match);
622 622
 
623
-        return isset($match[ 2 ]) ? $match[ 1 ] . $separator . ($match[ 2 ] + 1) : $string . $separator . $first;
623
+        return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $string.$separator.$first;
624 624
     }
625 625
 }
626 626
 
627 627
 // ------------------------------------------------------------------------
628 628
 
629
-if ( ! function_exists('str_alt')) {
629
+if (!function_exists('str_alt')) {
630 630
     /**
631 631
      * str_alt
632 632
      *
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
 
649 649
         $args = func_get_args();
650 650
 
651
-        return $args[ ($i++ % count($args)) ];
651
+        return $args[($i++ % count($args))];
652 652
     }
653 653
 }
654 654
 
655
-if ( ! function_exists('str_char_to_ascii')) {
655
+if (!function_exists('str_char_to_ascii')) {
656 656
     /**
657 657
      * str_char_to_ascii
658 658
      *
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     {
667 667
         static $array_from, $array_to;
668 668
 
669
-        if ( ! is_array($array_from)) {
669
+        if (!is_array($array_from)) {
670 670
             $foreign_characters = [
671 671
                 '/ä|æ|ǽ/'                                                     => 'ae',
672 672
                 '/ö|œ/'                                                       => 'oe',
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 // ------------------------------------------------------------------------
771 771
 
772 772
 
773
-if ( ! function_exists('str_entities_to_ascii')) {
773
+if (!function_exists('str_entities_to_ascii')) {
774 774
     /**
775 775
      * str_entities_to_ascii
776 776
      *
@@ -784,22 +784,22 @@  discard block
 block discarded – undo
784 784
     function str_entities_to_ascii($string, $all = true)
785 785
     {
786 786
         if (preg_match_all('/\&#(\d+)\;/', $string, $matches)) {
787
-            for ($i = 0, $s = count($matches[ 0 ]); $i < $s; $i++) {
788
-                $digits = $matches[ 1 ][ $i ];
787
+            for ($i = 0, $s = count($matches[0]); $i < $s; $i++) {
788
+                $digits = $matches[1][$i];
789 789
                 $out = '';
790 790
 
791 791
                 if ($digits < 128) {
792 792
                     $out .= chr($digits);
793 793
 
794 794
                 } elseif ($digits < 2048) {
795
-                    $out .= chr(192 + (($digits - ($digits % 64)) / 64)) . chr(128 + ($digits % 64));
795
+                    $out .= chr(192 + (($digits - ($digits % 64)) / 64)).chr(128 + ($digits % 64));
796 796
                 } else {
797 797
                     $out .= chr(224 + (($digits - ($digits % 4096)) / 4096))
798 798
                         . chr(128 + ((($digits % 4096) - ($digits % 64)) / 64))
799 799
                         . chr(128 + ($digits % 64));
800 800
                 }
801 801
 
802
-                $string = str_replace($matches[ 0 ][ $i ], $out, $string);
802
+                $string = str_replace($matches[0][$i], $out, $string);
803 803
             }
804 804
         }
805 805
 
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 // ------------------------------------------------------------------------
819 819
 
820 820
 
821
-if ( ! function_exists('str_ascii_to_entities')) {
821
+if (!function_exists('str_ascii_to_entities')) {
822 822
     /**
823 823
      * str_ascii_to_entities
824 824
      *
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
     {
833 833
         $out = '';
834 834
         for ($i = 0, $s = strlen($string) - 1, $count = 1, $temp = []; $i <= $s; $i++) {
835
-            $ordinal = ord($string[ $i ]);
835
+            $ordinal = ord($string[$i]);
836 836
 
837 837
             if ($ordinal < 128) {
838 838
                 /*
@@ -840,11 +840,11 @@  discard block
 block discarded – undo
840 840
                     fair that we output that entity and restart $temp before continuing. -Paul
841 841
                 */
842 842
                 if (count($temp) === 1) {
843
-                    $out .= '&#' . array_shift($temp) . ';';
843
+                    $out .= '&#'.array_shift($temp).';';
844 844
                     $count = 1;
845 845
                 }
846 846
 
847
-                $out .= $string[ $i ];
847
+                $out .= $string[$i];
848 848
             } else {
849 849
                 if (count($temp) === 0) {
850 850
                     $count = ($ordinal < 224) ? 2 : 3;
@@ -854,15 +854,15 @@  discard block
 block discarded – undo
854 854
 
855 855
                 if (count($temp) === $count) {
856 856
                     $number = ($count === 3)
857
-                        ? (($temp[ 0 ] % 16) * 4096) + (($temp[ 1 ] % 64) * 64) + ($temp[ 2 ] % 64)
858
-                        : (($temp[ 0 ] % 32) * 64) + ($temp[ 1 ] % 64);
857
+                        ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64)
858
+                        : (($temp[0] % 32) * 64) + ($temp[1] % 64);
859 859
 
860
-                    $out .= '&#' . $number . ';';
860
+                    $out .= '&#'.$number.';';
861 861
                     $count = 1;
862 862
                     $temp = [];
863 863
                 } // If this is the last iteration, just output whatever we have
864 864
                 elseif ($i === $s) {
865
-                    $out .= '&#' . implode(';', $temp) . ';';
865
+                    $out .= '&#'.implode(';', $temp).';';
866 866
                 }
867 867
             }
868 868
         }
Please login to merge, or discard this patch.
src/Helpers/Html.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 // ------------------------------------------------------------------------
18 18
 
19
-if ( ! function_exists('tag')) {
19
+if (!function_exists('tag')) {
20 20
     /**
21 21
      * tag
22 22
      *
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                 $element->textContent->push($contents);
57 57
             }
58 58
 
59
-            if ( ! is_null($contents)) {
59
+            if (!is_null($contents)) {
60 60
                 return $element->render();
61 61
             } else {
62 62
                 return $element->open();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 // ------------------------------------------------------------------------
69 69
 
70
-if ( ! function_exists('video')) {
70
+if (!function_exists('video')) {
71 71
     /**
72 72
      * video
73 73
      *
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             }
103 103
 
104 104
             $source->attributes->addAttribute('src', $src);
105
-            $source->attributes->addAttribute('type', 'video/' . $ext);
105
+            $source->attributes->addAttribute('type', 'video/'.$ext);
106 106
             $video->childNodes->push($source);
107 107
         }
108 108
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
 // ------------------------------------------------------------------------
116 116
 
117
-if ( ! function_exists('audio')) {
117
+if (!function_exists('audio')) {
118 118
     /**
119 119
      * audio
120 120
      *
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             }
148 148
 
149 149
             $source->attributes->addAttribute('src', $src);
150
-            $source->attributes->addAttribute('type', 'audio/' . $ext);
150
+            $source->attributes->addAttribute('type', 'audio/'.$ext);
151 151
             $audio->childNodes->push($source);
152 152
         }
153 153
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
 // ------------------------------------------------------------------------
161 161
 
162
-if ( ! function_exists('canvas')) {
162
+if (!function_exists('canvas')) {
163 163
     /**
164 164
      * canvas
165 165
      *
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 }
187 187
 // ------------------------------------------------------------------------
188 188
 
189
-if ( ! function_exists('heading')) {
189
+if (!function_exists('heading')) {
190 190
     /**
191 191
      * heading
192 192
      *
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
 // ------------------------------------------------------------------------
208 208
 
209
-if ( ! function_exists('ul')) {
209
+if (!function_exists('ul')) {
210 210
     /**
211 211
      * ul
212 212
      *
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 // ------------------------------------------------------------------------
227 227
 
228
-if ( ! function_exists('ol')) {
228
+if (!function_exists('ol')) {
229 229
     /**
230 230
      * ol
231 231
      *
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 // ------------------------------------------------------------------------
246 246
 
247
-if ( ! function_exists('img')) {
247
+if (!function_exists('img')) {
248 248
     /**
249 249
      * img
250 250
      *
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
 // ------------------------------------------------------------------------
269 269
 
270
-if ( ! function_exists('meta')) {
270
+if (!function_exists('meta')) {
271 271
     /**
272 272
      * meta
273 273
      *
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
     {
284 284
         // Since we allow the data to be passes as a string, a simple array
285 285
         // or a multidimensional one, we need to do a little prepping.
286
-        if ( ! is_array($meta)) {
286
+        if (!is_array($meta)) {
287 287
             $meta = [['name' => $meta, 'content' => $content, 'type']];
288
-        } elseif (isset($meta[ 'name' ])) {
288
+        } elseif (isset($meta['name'])) {
289 289
             // Turn single array into multidimensional
290 290
             $meta = [$meta];
291 291
         }
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
         foreach ($meta as $attributes) {
296 296
             $element = new \O2System\Html\Element('meta');
297 297
             $element->attributes->addAttribute('type',
298
-                (isset($attributes[ 'type' ]) && $attributes[ 'type' ] !== 'name') ? 'http-equiv' : 'name');
298
+                (isset($attributes['type']) && $attributes['type'] !== 'name') ? 'http-equiv' : 'name');
299 299
             $element->attributes->addAttribute('name',
300
-                isset($attributes[ 'content' ]) ? $attributes[ 'content' ] : '');
300
+                isset($attributes['content']) ? $attributes['content'] : '');
301 301
             $element->attributes->addAttribute('name',
302
-                isset($attributes[ 'content' ]) ? $attributes[ 'content' ] : '');
302
+                isset($attributes['content']) ? $attributes['content'] : '');
303 303
 
304 304
             if (count($attributes)) {
305 305
                 foreach ($attributes as $meta => $value) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
 // ------------------------------------------------------------------------
318 318
 
319
-if ( ! function_exists('parse_attributes')) {
319
+if (!function_exists('parse_attributes')) {
320 320
     /**
321 321
      * parse_attributes
322 322
      *
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
             if (is_html($string)) {
335 335
                 $xml = simplexml_load_string(str_replace('>', '/>', $string));
336 336
             } else {
337
-                $xml = simplexml_load_string('<tag ' . $string . '/>');
337
+                $xml = simplexml_load_string('<tag '.$string.'/>');
338 338
             }
339 339
 
340 340
             foreach ($xml->attributes() as $key => $node) {
341
-                $attributes[ $key ] = (string)$node;
341
+                $attributes[$key] = (string) $node;
342 342
             }
343 343
         }
344 344
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
 // ------------------------------------------------------------------------
350 350
 
351
-if ( ! function_exists('remove_tags')) {
351
+if (!function_exists('remove_tags')) {
352 352
     /**
353 353
      * Remove Tag
354 354
      *
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     function remove_tags($html, $tags, $strip_content = false)
365 365
     {
366 366
         $content = '';
367
-        if ( ! is_array($tags)) {
367
+        if (!is_array($tags)) {
368 368
             $tags = (strpos($html, '>') !== false ? explode('>', str_replace('<', '', $tags)) : [$tags]);
369 369
             if (end($tags) == '') {
370 370
                 array_pop($tags);
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
         }
373 373
         foreach ($tags as $tag) {
374 374
             if ($strip_content) {
375
-                $content = '(.+</' . $tag . '[^>]*>|)';
375
+                $content = '(.+</'.$tag.'[^>]*>|)';
376 376
             }
377 377
 
378
-            $html = preg_replace('#</?' . $tag . '[^>]*>' . $content . '#is', '', $html);
378
+            $html = preg_replace('#</?'.$tag.'[^>]*>'.$content.'#is', '', $html);
379 379
         }
380 380
 
381 381
         return $html;
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
 // ------------------------------------------------------------------------
386 386
 
387
-if ( ! function_exists('extract_tag')) {
387
+if (!function_exists('extract_tag')) {
388 388
     /**
389 389
      * Extract Tag
390 390
      *
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
      */
398 398
     function extract_tag($html, $tag = 'div')
399 399
     {
400
-        $html = preg_match_all("/(\<" . $tag . ")(.*?)(" . $tag . ">)/si", $html, $matches);
400
+        $html = preg_match_all("/(\<".$tag.")(.*?)(".$tag.">)/si", $html, $matches);
401 401
 
402 402
         $result = '';
403
-        foreach ($matches[ 0 ] as $item) {
404
-            $result = preg_replace("/\<[\/]?" . $tag . "\>/", '', $item);
403
+        foreach ($matches[0] as $item) {
404
+            $result = preg_replace("/\<[\/]?".$tag."\>/", '', $item);
405 405
         }
406 406
 
407 407
         return $result;
Please login to merge, or discard this patch.
src/Models/NoSql/Model.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -140,23 +140,23 @@  discard block
 block discarded – undo
140 140
         $filename = pathinfo($filePath, PATHINFO_FILENAME);
141 141
 
142 142
         // Get model class directory name
143
-        $dirName = dirname($filePath) . DIRECTORY_SEPARATOR;
143
+        $dirName = dirname($filePath).DIRECTORY_SEPARATOR;
144 144
 
145 145
         if ($filename === 'Model') {
146
-            $subModelsDirName = dirname($dirName) . DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR;
146
+            $subModelsDirName = dirname($dirName).DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR;
147 147
 
148 148
             if (is_dir($subModelsDirName)) {
149 149
                 $subModelPath = $subModelsDirName;
150 150
             }
151
-        } elseif (is_dir($subModelsDirName = $dirName . $filename . DIRECTORY_SEPARATOR)) {
151
+        } elseif (is_dir($subModelsDirName = $dirName.$filename.DIRECTORY_SEPARATOR)) {
152 152
             $subModelPath = $subModelsDirName;
153 153
         }
154 154
 
155 155
         if (isset($subModelPath)) {
156 156
             loader()->addNamespace($reflection->name, $subModelPath);
157 157
 
158
-            foreach (glob($subModelPath . '*.php') as $filepath) {
159
-                $this->validSubModels[ strtolower(pathinfo($filepath, PATHINFO_FILENAME)) ] = $filepath;
158
+            foreach (glob($subModelPath.'*.php') as $filepath) {
159
+                $this->validSubModels[strtolower(pathinfo($filepath, PATHINFO_FILENAME))] = $filepath;
160 160
             }
161 161
         }
162 162
     }
@@ -183,25 +183,25 @@  discard block
 block discarded – undo
183 183
 
184 184
     public function &__get($property)
185 185
     {
186
-        $get[ $property ] = false;
186
+        $get[$property] = false;
187 187
 
188 188
         if (services()->has($property)) {
189
-            $get[ $property ] = services()->get($property);
189
+            $get[$property] = services()->get($property);
190 190
         } elseif (array_key_exists($property, $this->validSubModels)) {
191
-            $get[ $property ] = $this->loadSubModel($property);
191
+            $get[$property] = $this->loadSubModel($property);
192 192
         } elseif (o2system()->__isset($property)) {
193
-            $get[ $property ] = o2system()->__get($property);
193
+            $get[$property] = o2system()->__get($property);
194 194
         }
195 195
 
196
-        return $get[ $property ];
196
+        return $get[$property];
197 197
     }
198 198
 
199 199
     // ------------------------------------------------------------------------
200 200
 
201 201
     final protected function loadSubModel($model)
202 202
     {
203
-        if (is_file($this->validSubModels[ $model ])) {
204
-            $className = '\\' . get_called_class() . '\\' . ucfirst($model);
203
+        if (is_file($this->validSubModels[$model])) {
204
+            $className = '\\'.get_called_class().'\\'.ucfirst($model);
205 205
             $className = str_replace('\Base\\Model', '\Models', $className);
206 206
 
207 207
             if (class_exists($className)) {
Please login to merge, or discard this patch.
src/Models/Sql/Model.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -143,27 +143,27 @@  discard block
 block discarded – undo
143 143
         $filename = pathinfo($filePath, PATHINFO_FILENAME);
144 144
 
145 145
         // Get model class directory name
146
-        $dirName = dirname($filePath) . DIRECTORY_SEPARATOR;
146
+        $dirName = dirname($filePath).DIRECTORY_SEPARATOR;
147 147
 
148 148
         // Get sub models or siblings models
149 149
         if ($filename === 'Model' || $filename === modules()->current()->getDirName()) {
150
-            $subModelsDirName = dirname($dirName) . DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR;
150
+            $subModelsDirName = dirname($dirName).DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR;
151 151
 
152 152
             if (is_dir($subModelsDirName)) {
153 153
                 $subModelPath = $subModelsDirName;
154 154
             }
155
-        } elseif (is_dir($subModelsDirName = $dirName . $filename . DIRECTORY_SEPARATOR)) {
155
+        } elseif (is_dir($subModelsDirName = $dirName.$filename.DIRECTORY_SEPARATOR)) {
156 156
             $subModelPath = $subModelsDirName;
157 157
         }
158 158
 
159 159
         if (isset($subModelPath)) {
160 160
             loader()->addNamespace($reflection->name, $subModelPath);
161 161
 
162
-            foreach (glob($subModelPath . '*.php') as $filepath) {
162
+            foreach (glob($subModelPath.'*.php') as $filepath) {
163 163
                 if ($filepath === $filePath) {
164 164
                     continue;
165 165
                 }
166
-                $this->validSubModels[ camelcase(pathinfo($filepath, PATHINFO_FILENAME)) ] = $filepath;
166
+                $this->validSubModels[camelcase(pathinfo($filepath, PATHINFO_FILENAME))] = $filepath;
167 167
             }
168 168
         }
169 169
     }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     {
175 175
         $modelClassName = get_called_class();
176 176
 
177
-        if ( ! models()->has($modelClassName)) {
177
+        if (!models()->has($modelClassName)) {
178 178
             models()->load($modelClassName, $modelClassName);
179 179
         }
180 180
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             }
211 211
         }
212 212
 
213
-        if (empty($get[ $property ])) {
213
+        if (empty($get[$property])) {
214 214
             if (services()->has($property)) {
215 215
                 return services()->get($property);
216 216
             } elseif ($this->hasSubModel($property)) {
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
     {
230 230
         if ($this->hasSubModel($model)) {
231 231
             $classNames = [
232
-                '\\' . get_called_class() . '\\' . ucfirst($model),
233
-                '\\' . get_namespace(get_called_class()) . ucfirst($model),
232
+                '\\'.get_called_class().'\\'.ucfirst($model),
233
+                '\\'.get_namespace(get_called_class()).ucfirst($model),
234 234
             ];
235 235
 
236 236
             foreach ($classNames as $className) {
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     final protected function hasSubModel($model)
252 252
     {
253 253
         if (array_key_exists($model, $this->validSubModels)) {
254
-            return (bool)is_file($this->validSubModels[ $model ]);
254
+            return (bool) is_file($this->validSubModels[$model]);
255 255
         }
256 256
 
257 257
         return false;
Please login to merge, or discard this patch.
src/Http/Controller.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 {
25 25
     public function &__get($property)
26 26
     {
27
-        $get[ $property ] = false;
27
+        $get[$property] = false;
28 28
 
29 29
         // CodeIgniter property aliasing
30 30
         if ($property === 'load') {
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
         }
33 33
 
34 34
         if (services()->has($property)) {
35
-            $get[ $property ] = services()->get($property);
35
+            $get[$property] = services()->get($property);
36 36
         } elseif (o2system()->__isset($property)) {
37
-            $get[ $property ] = o2system()->__get($property);
37
+            $get[$property] = o2system()->__get($property);
38 38
         } elseif ($property === 'model') {
39
-            $get[ $property ] = models('controller');
39
+            $get[$property] = models('controller');
40 40
         } elseif ($property === 'services' || $property === 'libraries') {
41
-            $get[ $property ] = services();
41
+            $get[$property] = services();
42 42
         }
43 43
 
44
-        return $get[ $property ];
44
+        return $get[$property];
45 45
     }
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
src/Services/Loader.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     public function addNamespace($namespace, $baseDirectory, $prepend = false)
115 115
     {
116 116
         // normalize namespace prefix
117
-        $namespace = trim($namespace, '\\') . '\\';
117
+        $namespace = trim($namespace, '\\').'\\';
118 118
 
119 119
         if (empty($namespace) OR $namespace === '\\') {
120 120
             return;
@@ -122,24 +122,24 @@  discard block
 block discarded – undo
122 122
 
123 123
         // normalize the base directory with a trailing separator
124 124
         $baseDirectory = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $baseDirectory);
125
-        $baseDirectory = rtrim($baseDirectory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
125
+        $baseDirectory = rtrim($baseDirectory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
126 126
 
127 127
         if (is_dir($baseDirectory)) {
128 128
             // initialize the namespace prefix array
129
-            if (isset($this->namespaceDirs[ $namespace ]) === false) {
130
-                $this->namespaceDirs[ $namespace ] = [];
129
+            if (isset($this->namespaceDirs[$namespace]) === false) {
130
+                $this->namespaceDirs[$namespace] = [];
131 131
             }
132 132
 
133 133
             // retain the base directory for the namespace prefix
134
-            if ( ! in_array($baseDirectory, $this->namespaceDirs[ $namespace ])) {
134
+            if (!in_array($baseDirectory, $this->namespaceDirs[$namespace])) {
135 135
                 if ($prepend) {
136
-                    array_unshift($this->namespaceDirs[ $namespace ], $baseDirectory);
136
+                    array_unshift($this->namespaceDirs[$namespace], $baseDirectory);
137 137
                 } else {
138
-                    array_push($this->namespaceDirs[ $namespace ], $baseDirectory);
138
+                    array_push($this->namespaceDirs[$namespace], $baseDirectory);
139 139
                 }
140 140
             }
141 141
 
142
-            $this->namespaceDirsMap[ $baseDirectory ] = $namespace;
142
+            $this->namespaceDirsMap[$baseDirectory] = $namespace;
143 143
 
144 144
             // Register Namespace Language
145 145
             language()->addFilePath($baseDirectory);
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
             output()->addFilePath($baseDirectory);
149 149
 
150 150
             // Autoload Composer
151
-            if (is_file($baseDirectory . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php')) {
152
-                require($baseDirectory . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
151
+            if (is_file($baseDirectory.'vendor'.DIRECTORY_SEPARATOR.'autoload.php')) {
152
+                require($baseDirectory.'vendor'.DIRECTORY_SEPARATOR.'autoload.php');
153 153
             }
154 154
         }
155 155
     }
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
         $dir = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $dir);
171 171
 
172 172
         $dir = realpath($dir);
173
-        $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
173
+        $dir = rtrim($dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
174 174
 
175 175
         if (array_key_exists($dir, $this->namespaceDirsMap)) {
176
-            return $this->namespaceDirsMap[ $dir ];
176
+            return $this->namespaceDirsMap[$dir];
177 177
         }
178 178
 
179 179
         return false;
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public function getNamespaceDirs($namespace)
213 213
     {
214
-        $namespace = trim($namespace, '\\') . '\\';
214
+        $namespace = trim($namespace, '\\').'\\';
215 215
 
216 216
         if (array_key_exists($namespace, $this->namespaceDirs)) {
217
-            return $this->namespaceDirs[ $namespace ];
217
+            return $this->namespaceDirs[$namespace];
218 218
         }
219 219
 
220 220
         return false;
@@ -237,29 +237,29 @@  discard block
 block discarded – undo
237 237
         }
238 238
 
239 239
         if ($this->requireFile($helper)) {
240
-            $this->loadedHelpers[ pathinfo($helper, PATHINFO_FILENAME) ][] = $helper;
240
+            $this->loadedHelpers[pathinfo($helper, PATHINFO_FILENAME)][] = $helper;
241 241
 
242 242
             return;
243 243
         }
244 244
 
245 245
         $helperDirectories = [
246
-            PATH_KERNEL . 'Helpers' . DIRECTORY_SEPARATOR,
247
-            PATH_FRAMEWORK . 'Helpers' . DIRECTORY_SEPARATOR,
248
-            PATH_APP . 'Helpers' . DIRECTORY_SEPARATOR,
246
+            PATH_KERNEL.'Helpers'.DIRECTORY_SEPARATOR,
247
+            PATH_FRAMEWORK.'Helpers'.DIRECTORY_SEPARATOR,
248
+            PATH_APP.'Helpers'.DIRECTORY_SEPARATOR,
249 249
         ];
250 250
         
251
-        if ( ! array_key_exists($helper, $this->loadedHelpers)) {
252
-            $this->loadedHelpers[ $helper ] = [];
251
+        if (!array_key_exists($helper, $this->loadedHelpers)) {
252
+            $this->loadedHelpers[$helper] = [];
253 253
         }
254 254
 
255 255
         foreach ($helperDirectories as $helperDirectory) {
256 256
 
257
-            $helperFilePath = $helperDirectory . studlycase($helper) . '.php';
257
+            $helperFilePath = $helperDirectory.studlycase($helper).'.php';
258 258
 
259
-            if (in_array($helperFilePath, $this->loadedHelpers[ $helper ])) {
259
+            if (in_array($helperFilePath, $this->loadedHelpers[$helper])) {
260 260
                 continue;
261 261
             } elseif ($this->requireFile($helperFilePath)) {
262
-                $this->loadedHelpers[ $helper ][] = $helperFilePath;
262
+                $this->loadedHelpers[$helper][] = $helperFilePath;
263 263
             }
264 264
         }
265 265
     }
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
     public function loadMappedFile($namespace, $relativeClass)
336 336
     {
337 337
         // are there any base directories for this namespace prefix?
338
-        if (isset($this->namespaceDirs[ $namespace ]) === false) {
338
+        if (isset($this->namespaceDirs[$namespace]) === false) {
339 339
             return false;
340 340
         }
341 341
 
342 342
         // look through base directories for this namespace prefix
343
-        foreach ($this->namespaceDirs[ $namespace ] as $namespaceDirectory) {
343
+        foreach ($this->namespaceDirs[$namespace] as $namespaceDirectory) {
344 344
 
345 345
             // replace the namespace prefix with the base directory,
346 346
             // replace namespace separators with directory separators
Please login to merge, or discard this patch.
src/Http/Middleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      */
45 45
     public function run()
46 46
     {
47
-        if ( ! empty($this->registry)) {
47
+        if (!empty($this->registry)) {
48 48
 
49 49
             $request = server_request();
50 50
 
Please login to merge, or discard this patch.