@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @var array |
80 | 80 | */ |
81 | - protected $attributes = []; |
|
81 | + protected $attributes = [ ]; |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * The model attribute's original state. |
85 | 85 | * |
86 | 86 | * @var array |
87 | 87 | */ |
88 | - protected $original = []; |
|
88 | + protected $original = [ ]; |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * The number of models to return for pagination. |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * Model constructor. |
121 | 121 | * @param array $attributes |
122 | 122 | */ |
123 | - public function __construct(array $attributes = []) |
|
123 | + public function __construct(array $attributes = [ ]) |
|
124 | 124 | { |
125 | 125 | $this->bootIfNotBooted(); |
126 | 126 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function bootIfNotBooted() |
141 | 141 | { |
142 | - if (! self::$isBooted) { |
|
142 | + if (!self::$isBooted) { |
|
143 | 143 | self::boot(); |
144 | 144 | |
145 | 145 | self::$isBooted = true; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function syncOriginalAttribute($attribute) |
168 | 168 | { |
169 | - $this->original[$attribute] = $this->attributes[$attribute]; |
|
169 | + $this->original[ $attribute ] = $this->attributes[ $attribute ]; |
|
170 | 170 | |
171 | 171 | return $this; |
172 | 172 | } |
@@ -293,13 +293,13 @@ discard block |
||
293 | 293 | * @param array $columns |
294 | 294 | * @return mixed |
295 | 295 | */ |
296 | - public static function all(array $columns = ['*']) |
|
296 | + public static function all(array $columns = [ '*' ]) |
|
297 | 297 | { |
298 | 298 | $instance = new static(); |
299 | 299 | /** @var ArrayObject $result */ |
300 | 300 | $result = $instance->newQuery()->get($columns); |
301 | 301 | |
302 | - $result->map(function ($item) { |
|
302 | + $result->map(function($item) { |
|
303 | 303 | $item->exists = true; |
304 | 304 | }); |
305 | 305 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $instance = new static(); |
316 | 316 | $result = $instance->newQuery()->find($id); |
317 | 317 | |
318 | - if (! is_null($result)) { |
|
318 | + if (!is_null($result)) { |
|
319 | 319 | $result->exists = true; |
320 | 320 | } |
321 | 321 | |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | { |
352 | 352 | $instance = new static(); |
353 | 353 | |
354 | - if (! is_array($id)) { |
|
355 | - $id = [$id]; |
|
354 | + if (!is_array($id)) { |
|
355 | + $id = [ $id ]; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | return $instance->newQuery()->remove($id); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public function setAttribute($key, $value) |
384 | 384 | { |
385 | - $this->attributes[$key] = $value; |
|
385 | + $this->attributes[ $key ] = $value; |
|
386 | 386 | |
387 | 387 | return $this; |
388 | 388 | } |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | */ |
401 | 401 | public function getAttribute($key) |
402 | 402 | { |
403 | - if (! $key) { |
|
403 | + if (!$key) { |
|
404 | 404 | return; |
405 | 405 | } |
406 | 406 | |
407 | - $attr = $this->getAttributes()[$key]; |
|
407 | + $attr = $this->getAttributes()[ $key ]; |
|
408 | 408 | |
409 | 409 | if (isset($attr)) { |
410 | 410 | return $attr; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | */ |
577 | 577 | public function offsetExists($offset) |
578 | 578 | { |
579 | - return isset($this->attributes[$offset]); |
|
579 | + return isset($this->attributes[ $offset ]); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | /** |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function offsetGet($offset) |
592 | 592 | { |
593 | - return $this->attributes[$offset]; |
|
593 | + return $this->attributes[ $offset ]; |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | /** |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | */ |
608 | 608 | public function offsetSet($offset, $value) |
609 | 609 | { |
610 | - $this->attributes[$offset] = $value; |
|
610 | + $this->attributes[ $offset ] = $value; |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | */ |
622 | 622 | public function offsetUnset($offset) |
623 | 623 | { |
624 | - unset($this->attributes[$offset]); |
|
624 | + unset($this->attributes[ $offset ]); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | /** |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | { |
690 | 690 | $time = $this->freshTimestamp(); |
691 | 691 | |
692 | - if (! is_null(static::UPDATED_AT) ) { |
|
692 | + if (!is_null(static::UPDATED_AT)) { |
|
693 | 693 | $this->setUpdatedAt($time); |
694 | 694 | } |
695 | 695 | |
696 | - if (! is_null(static::CREATED_AT)) { |
|
696 | + if (!is_null(static::CREATED_AT)) { |
|
697 | 697 | $this->setCreatedAt($time); |
698 | 698 | } |
699 | 699 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | private $host = false; |
30 | 30 | private $port = ''; |
31 | 31 | private $path = ''; |
32 | - private $query = []; |
|
32 | + private $query = [ ]; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Constructor. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function __construct($value) |
41 | 41 | { |
42 | - if($this->isInstanceOf($value, $this)) { |
|
42 | + if ($this->isInstanceOf($value, $this)) { |
|
43 | 43 | return $value; |
44 | 44 | } |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $this->validateUrl(); |
51 | 51 | } catch (\Exception $e) { |
52 | - handle(new UrlObjectException(UrlObjectException::MSG_INVALID_URL, [$value])); |
|
52 | + handle(new UrlObjectException(UrlObjectException::MSG_INVALID_URL, [ $value ])); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | |
84 | 84 | // parse query string |
85 | 85 | $query = ''; |
86 | - if($parts->keyExists('query')) { |
|
87 | - if(self::isString($parts->key('query'))) { |
|
86 | + if ($parts->keyExists('query')) { |
|
87 | + if (self::isString($parts->key('query'))) { |
|
88 | 88 | parse_str($parts->key('query'), $queryData); |
89 | 89 | } else { |
90 | 90 | $queryData = $parts->key('query'); |
91 | 91 | } |
92 | 92 | |
93 | - if(self::isArray($queryData)) { |
|
93 | + if (self::isArray($queryData)) { |
|
94 | 94 | $query = $queryData; |
95 | 95 | } |
96 | 96 | } |
@@ -102,30 +102,30 @@ discard block |
||
102 | 102 | $url = ''; |
103 | 103 | |
104 | 104 | // scheme |
105 | - if($scheme && $scheme != '') { |
|
106 | - $url .= $scheme . '://'; |
|
105 | + if ($scheme && $scheme != '') { |
|
106 | + $url .= $scheme.'://'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // host |
110 | - if($host && $host != '') { |
|
110 | + if ($host && $host != '') { |
|
111 | 111 | $url .= $host; |
112 | 112 | } |
113 | 113 | |
114 | 114 | // port |
115 | - if($port != '') { |
|
116 | - $url .= ':' . $port; |
|
115 | + if ($port != '') { |
|
116 | + $url .= ':'.$port; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // path |
120 | - if($path != '') { |
|
120 | + if ($path != '') { |
|
121 | 121 | $url .= $path; |
122 | 122 | } |
123 | 123 | |
124 | 124 | // query |
125 | - if(self::isArray($query)) { |
|
125 | + if (self::isArray($query)) { |
|
126 | 126 | $query = http_build_query($query); |
127 | - if($query != "") { |
|
128 | - $url .= '?' . $query; |
|
127 | + if ($query != "") { |
|
128 | + $url .= '?'.$query; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function getDomain() |
205 | 205 | { |
206 | - if($this->getScheme() && $this->getHost()) { |
|
207 | - return $this->getScheme() . '://' . $this->getHost(); |
|
206 | + if ($this->getScheme() && $this->getHost()) { |
|
207 | + return $this->getScheme().'://'.$this->getHost(); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | return false; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function getPath($asStringObject = false) |
221 | 221 | { |
222 | - if($asStringObject) { |
|
222 | + if ($asStringObject) { |
|
223 | 223 | return $this->str($this->path); |
224 | 224 | } |
225 | 225 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function val($url = null) |
238 | 238 | { |
239 | - if($this->isNull($url)) { |
|
239 | + if ($this->isNull($url)) { |
|
240 | 240 | return $this->value; |
241 | 241 | } |
242 | 242 | |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | { |
267 | 267 | $urlData = parse_url($this->val()); |
268 | 268 | |
269 | - if(!$urlData || !$this->isArray($urlData)) { |
|
270 | - throw new UrlObjectException(UrlObjectException::MSG_INVALID_URL, [$this->val()]); |
|
269 | + if (!$urlData || !$this->isArray($urlData)) { |
|
270 | + throw new UrlObjectException(UrlObjectException::MSG_INVALID_URL, [ $this->val() ]); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | // extract parts |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | $this->path = $urlData->key('path', '', true); |
284 | 284 | |
285 | 285 | // parse query string |
286 | - if($urlData->keyExists('query')) { |
|
286 | + if ($urlData->keyExists('query')) { |
|
287 | 287 | parse_str($urlData->key('query'), $queryData); |
288 | - if($this->isArray($queryData)) { |
|
288 | + if ($this->isArray($queryData)) { |
|
289 | 289 | $this->query = $queryData; |
290 | 290 | } |
291 | 291 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $text = 'HTTP Version not supported'; |
415 | 415 | break; |
416 | 416 | default: |
417 | - throw new UrlObjectException(UrlObjectException::MSG_ARG_OUT_OF_RANGE, [$headerCode]); |
|
417 | + throw new UrlObjectException(UrlObjectException::MSG_ARG_OUT_OF_RANGE, [ $headerCode ]); |
|
418 | 418 | break; |
419 | 419 | } |
420 | 420 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | class ArrayObject extends AbstractStdObject implements ArrayAccess, Countable, IteratorAggregate |
18 | 18 | { |
19 | - use ValidatorTrait,ManipulationTrait,StdObjectTrait; |
|
19 | + use ValidatorTrait, ManipulationTrait, StdObjectTrait; |
|
20 | 20 | |
21 | 21 | protected $value; |
22 | 22 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct($value, $makeArrayObj = false) |
28 | 28 | { |
29 | - if($this->isAccessible($value)){ |
|
29 | + if ($this->isAccessible($value)) { |
|
30 | 30 | $this->val($value); |
31 | 31 | } else { |
32 | 32 | handle(new \Exception("Your value must be an array.")); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function offsetGet($offset) |
105 | 105 | { |
106 | - return $this->value[$offset]; |
|
106 | + return $this->value[ $offset ]; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function difference($arr) |
25 | 25 | { |
26 | - $attributes = []; |
|
26 | + $attributes = [ ]; |
|
27 | 27 | foreach ($this->val() as $attKey => $attribute) { |
28 | 28 | foreach ($arr as $oriKey => $original) { |
29 | 29 | if ($attKey == $oriKey) { |
30 | 30 | if ($attribute !== $original) { |
31 | - $attributes[$attKey] = $attribute; |
|
31 | + $attributes[ $attKey ] = $attribute; |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | $array = $this->val(); |
62 | 62 | } |
63 | 63 | |
64 | - $results = []; |
|
64 | + $results = [ ]; |
|
65 | 65 | foreach ($array as $key => $value) { |
66 | - if (is_array($value) && ! empty($value)) { |
|
66 | + if (is_array($value) && !empty($value)) { |
|
67 | 67 | $results = array_merge($results, $this->dot($value, $prepend.$key.'.')); |
68 | 68 | } else { |
69 | - $results[$prepend.$key] = $value; |
|
69 | + $results[ $prepend.$key ] = $value; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | return $results; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function divide() |
81 | 81 | { |
82 | - return [$this->getKeys(), $this->getOnlyValues()]; |
|
82 | + return [ $this->getKeys(), $this->getOnlyValues() ]; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function implode(string $glue, string $key = null) |
164 | 164 | { |
165 | - if (! function_exists(__NAMESPACE__.'\useGlue')) { |
|
165 | + if (!function_exists(__NAMESPACE__.'\useGlue')) { |
|
166 | 166 | // done this function to avoid writing redundant code |
167 | 167 | function useGlue(&$i, &$length, &$glue) { |
168 | 168 | // don't use glue if is last element |
169 | - if($i < $length) |
|
169 | + if ($i < $length) |
|
170 | 170 | return $glue; |
171 | 171 | else |
172 | 172 | return ""; |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | // check if val is key or obj |
181 | 181 | $i = 1; |
182 | 182 | foreach ($val as $item) { |
183 | - if(is_object($item)) { |
|
183 | + if (is_object($item)) { |
|
184 | 184 | $item = get_object_vars($this); |
185 | 185 | //TODO finnish this case |
186 | - } elseif(is_array($item)) { |
|
187 | - if(!isset($key)) |
|
186 | + } elseif (is_array($item)) { |
|
187 | + if (!isset($key)) |
|
188 | 188 | handle(new \Exception("\$key must be set!")); |
189 | 189 | |
190 | - $result .= $item[$key].useGlue($i, $length, $glue); |
|
190 | + $result .= $item[ $key ].useGlue($i, $length, $glue); |
|
191 | 191 | } else { |
192 | 192 | $result .= $item.useGlue($i, $length, $glue); |
193 | 193 | } |
@@ -212,24 +212,24 @@ discard block |
||
212 | 212 | $array = $this->val(); |
213 | 213 | |
214 | 214 | if ($setOnlyIfDoesntExist && !$this->keyExists($key)) { |
215 | - $array[$key] = $value; |
|
215 | + $array[ $key ] = $value; |
|
216 | 216 | $this->val($array); |
217 | 217 | |
218 | 218 | return $value; |
219 | 219 | } else { |
220 | 220 | if (!$setOnlyIfDoesntExist && !$this->isNull($value)) { |
221 | - $array[$key] = $value; |
|
221 | + $array[ $key ] = $value; |
|
222 | 222 | $this->val($array); |
223 | 223 | |
224 | 224 | return $this; |
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | - if (!isset($array[$key])) { |
|
228 | + if (!isset($array[ $key ])) { |
|
229 | 229 | return $value; |
230 | 230 | } |
231 | 231 | |
232 | - return $array[$key]; |
|
232 | + return $array[ $key ]; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | $array = $this->val(); |
248 | 248 | |
249 | 249 | if (!$this->isNull($v)) { |
250 | - $array[$k] = $v; |
|
250 | + $array[ $k ] = $v; |
|
251 | 251 | } else { |
252 | - $array[] = $k; |
|
252 | + $array[ ] = $k; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | $this->val($array); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | if (!$this->isNull($v)) { |
275 | 275 | $array = array_reverse($array, true); |
276 | - $array[$k] = $v; |
|
276 | + $array[ $k ] = $v; |
|
277 | 277 | $array = array_reverse($array, true); |
278 | 278 | } else { |
279 | 279 | array_unshift($array, $k); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | { |
294 | 294 | if ($this->keyExists($key)) { |
295 | 295 | $array = $this->val(); |
296 | - unset($array[$key]); |
|
296 | + unset($array[ $key ]); |
|
297 | 297 | |
298 | 298 | $this->val($array); |
299 | 299 | } |
@@ -310,10 +310,10 @@ discard block |
||
310 | 310 | public function map(callable $call) |
311 | 311 | { |
312 | 312 | $array = $this->val(); |
313 | - $result = []; |
|
313 | + $result = [ ]; |
|
314 | 314 | |
315 | 315 | foreach ($array as $key => $item) |
316 | - $result[] = call_user_func($call, $item, $key); |
|
316 | + $result[ ] = call_user_func($call, $item, $key); |
|
317 | 317 | |
318 | 318 | return new ArrayObject($result); |
319 | 319 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function merge($array) |
329 | 329 | { |
330 | - if($this->isInstanceOf($array, $this)){ |
|
330 | + if ($this->isInstanceOf($array, $this)) { |
|
331 | 331 | $array = $array->val(); |
332 | 332 | } |
333 | 333 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function mergeRecursive($array) |
347 | 347 | { |
348 | - if($this->isInstanceOf($array, $this)){ |
|
348 | + if ($this->isInstanceOf($array, $this)) { |
|
349 | 349 | $array = $array->val(); |
350 | 350 | } |
351 | 351 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | if (!$this->isArray($arr)) { |
372 | - $arr = [$arr]; |
|
372 | + $arr = [ $arr ]; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | return new ArrayObject($arr); |
@@ -456,15 +456,15 @@ discard block |
||
456 | 456 | */ |
457 | 457 | public function flatten(array $array = null, $depth = INF) |
458 | 458 | { |
459 | - $result = []; |
|
459 | + $result = [ ]; |
|
460 | 460 | $val = $array ?: $this->val(); |
461 | 461 | |
462 | 462 | foreach ($val as $item) { |
463 | 463 | $item = $item instanceof ArrayObject ? $item->val() : $item; |
464 | 464 | |
465 | - if (! is_array($item) or $item === []) { |
|
466 | - if ($item !== []) { |
|
467 | - $result[] = $item; |
|
465 | + if (!is_array($item) or $item === [ ]) { |
|
466 | + if ($item !== [ ]) { |
|
467 | + $result[ ] = $item; |
|
468 | 468 | } |
469 | 469 | } elseif ($depth === 1) { |
470 | 470 | $result = array_merge($result, array_values($item)); |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | public function dispatch( |
402 | 402 | Request $request = null, |
403 | 403 | AbstractResponse $response = null, |
404 | - $send_response = true, |
|
405 | - $capture = self::DISPATCH_NO_CAPTURE |
|
404 | + $send_response = true, |
|
405 | + $capture = self::DISPATCH_NO_CAPTURE |
|
406 | 406 | ) { |
407 | 407 | // Set/Initialize our objects to be sent in each callback |
408 | 408 | $this->request = $request ?: Request::createFromGlobals(); |
@@ -743,12 +743,12 @@ discard block |
||
743 | 743 | |
744 | 744 | // Older versions of PCRE require the 'P' in (?P<named>) |
745 | 745 | $pattern = '(?:' |
746 | - . ($pre !== '' ? $pre : null) |
|
747 | - . '(' |
|
748 | - . ($param !== '' ? "?P<$param>" : null) |
|
749 | - . $type |
|
750 | - . '))' |
|
751 | - . ($optional !== '' ? '?' : null); |
|
746 | + . ($pre !== '' ? $pre : null) |
|
747 | + . '(' |
|
748 | + . ($param !== '' ? "?P<$param>" : null) |
|
749 | + . $type |
|
750 | + . '))' |
|
751 | + . ($optional !== '' ? '?' : null); |
|
752 | 752 | |
753 | 753 | return $pattern; |
754 | 754 | }, |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | AbstractRouteFactory $route_factory = null |
209 | 209 | ) { |
210 | 210 | // Instantiate and fall back to defaults |
211 | - $this->service = $service ?: new ServiceProvider(); |
|
212 | - $this->app = $app ?: new App(); |
|
213 | - $this->routes = $routes ?: new RouteCollection(); |
|
211 | + $this->service = $service ?: new ServiceProvider(); |
|
212 | + $this->app = $app ?: new App(); |
|
213 | + $this->routes = $routes ?: new RouteCollection(); |
|
214 | 214 | $this->route_factory = $route_factory ?: new RouteFactory(); |
215 | 215 | |
216 | 216 | $this->error_callbacks = new SplStack(); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $capture = self::DISPATCH_NO_CAPTURE |
406 | 406 | ) { |
407 | 407 | // Set/Initialize our objects to be sent in each callback |
408 | - $this->request = $request ?: Request::createFromGlobals(); |
|
408 | + $this->request = $request ?: Request::createFromGlobals(); |
|
409 | 409 | $this->response = $response ?: new Response(); |
410 | 410 | |
411 | 411 | // Bind our objects to our service |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | // Test for HEAD request (like GET) |
469 | 469 | if (strcasecmp($req_method, 'HEAD') === 0 |
470 | 470 | && (strcasecmp($method, 'HEAD') === 0 |
471 | - || strcasecmp($method, 'GET') === 0 ) |
|
471 | + || strcasecmp($method, 'GET') === 0) |
|
472 | 472 | ) { |
473 | 473 | |
474 | 474 | $method_match = true; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $possible_match = (null === $method_match) || $method_match; |
482 | 482 | |
483 | 483 | // ! is used to negate a match |
484 | - if (isset($path[0]) && $path[0] === '!') { |
|
484 | + if (isset($path[ 0 ]) && $path[ 0 ] === '!') { |
|
485 | 485 | $negate = true; |
486 | 486 | $i = 1; |
487 | 487 | } else { |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | |
507 | 507 | continue; |
508 | 508 | |
509 | - } elseif (isset($path[$i]) && $path[$i] === '@') { |
|
509 | + } elseif (isset($path[ $i ]) && $path[ $i ] === '@') { |
|
510 | 510 | // @ is used to specify custom regex |
511 | 511 | |
512 | - $match = preg_match('`' . substr($path, $i + 1) . '`', $uri, $params); |
|
512 | + $match = preg_match('`'.substr($path, $i + 1).'`', $uri, $params); |
|
513 | 513 | |
514 | 514 | } else { |
515 | 515 | // Compiling and matching regular expressions is relatively |
@@ -518,25 +518,25 @@ discard block |
||
518 | 518 | $expression = null; |
519 | 519 | $regex = false; |
520 | 520 | $j = 0; |
521 | - $n = isset($path[$i]) ? $path[$i] : null; |
|
521 | + $n = isset($path[ $i ]) ? $path[ $i ] : null; |
|
522 | 522 | |
523 | 523 | // Find the longest non-regex substring and match it against the URI |
524 | 524 | while (true) { |
525 | - if (!isset($path[$i])) { |
|
525 | + if (!isset($path[ $i ])) { |
|
526 | 526 | break; |
527 | 527 | } elseif (false === $regex) { |
528 | 528 | $c = $n; |
529 | 529 | $regex = $c === '[' || $c === '(' || $c === '.'; |
530 | - if (false === $regex && false !== isset($path[$i+1])) { |
|
531 | - $n = $path[$i + 1]; |
|
530 | + if (false === $regex && false !== isset($path[ $i + 1 ])) { |
|
531 | + $n = $path[ $i + 1 ]; |
|
532 | 532 | $regex = $n === '?' || $n === '+' || $n === '*' || $n === '{'; |
533 | 533 | } |
534 | - if (false === $regex && $c !== '/' && (!isset($uri[$j]) || $c !== $uri[$j])) { |
|
534 | + if (false === $regex && $c !== '/' && (!isset($uri[ $j ]) || $c !== $uri[ $j ])) { |
|
535 | 535 | continue 2; |
536 | 536 | } |
537 | 537 | $j++; |
538 | 538 | } |
539 | - $expression .= $path[$i++]; |
|
539 | + $expression .= $path[ $i++ ]; |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | try { |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | |
645 | 645 | } else { |
646 | 646 | // Output capturing behavior |
647 | - switch($capture) { |
|
647 | + switch ($capture) { |
|
648 | 648 | case self::DISPATCH_CAPTURE_AND_RETURN: |
649 | 649 | $buffed_content = null; |
650 | 650 | while (ob_get_level() >= $this->output_buffer_level) { |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | protected function doMiddleware(Route $route) |
707 | 707 | { |
708 | 708 | /** @var MiddlewareInterface $middleware */ |
709 | - foreach($route->getMiddleware() as $middleware) { |
|
709 | + foreach ($route->getMiddleware() as $middleware) { |
|
710 | 710 | $middleware->handle($this->request()); |
711 | 711 | } |
712 | 712 | } |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | // First escape all of the non-named param (non [block]s) for regex-chars |
723 | 723 | $route = preg_replace_callback( |
724 | 724 | static::ROUTE_ESCAPE_REGEX, |
725 | - function ($match) { |
|
726 | - return preg_quote($match[0]); |
|
725 | + function($match) { |
|
726 | + return preg_quote($match[ 0 ]); |
|
727 | 727 | }, |
728 | 728 | $route |
729 | 729 | ); |
@@ -734,11 +734,11 @@ discard block |
||
734 | 734 | // Now let's actually compile the path |
735 | 735 | $route = preg_replace_callback( |
736 | 736 | static::ROUTE_COMPILE_REGEX, |
737 | - function ($match) use ($match_types) { |
|
737 | + function($match) use ($match_types) { |
|
738 | 738 | list(, $pre, $type, $param, $optional) = $match; |
739 | 739 | |
740 | - if (isset($match_types[$type])) { |
|
741 | - $type = $match_types[$type]; |
|
740 | + if (isset($match_types[ $type ])) { |
|
741 | + $type = $match_types[ $type ]; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | // Older versions of PCRE require the 'P' in (?P<named>) |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | |
780 | 780 | // Set an error handler temporarily |
781 | 781 | set_error_handler( |
782 | - function ($errno, $errstr) use (&$error_string) { |
|
782 | + function($errno, $errstr) use (&$error_string) { |
|
783 | 783 | $error_string = $errstr; |
784 | 784 | }, |
785 | 785 | E_NOTICE | E_WARNING |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | |
833 | 833 | // Make sure we are getting a valid route |
834 | 834 | if (null === $route) { |
835 | - throw new OutOfBoundsException('No such route with name: '. $route_name); |
|
835 | + throw new OutOfBoundsException('No such route with name: '.$route_name); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | $path = $route->getPath(); |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | // Use our compilation regex to reverse the path's compilation from its definition |
841 | 841 | $reversed_path = preg_replace_callback( |
842 | 842 | static::ROUTE_COMPILE_REGEX, |
843 | - function ($match) use ($params) { |
|
844 | - list($block, $pre, , $param, $optional) = $match; |
|
843 | + function($match) use ($params) { |
|
844 | + list($block, $pre,, $param, $optional) = $match; |
|
845 | 845 | |
846 | - if (isset($params[$param])) { |
|
847 | - return $pre. $params[$param]; |
|
846 | + if (isset($params[ $param ])) { |
|
847 | + return $pre.$params[ $param ]; |
|
848 | 848 | } elseif ($optional) { |
849 | 849 | return ''; |
850 | 850 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | use app\framework\Component\StdLib\SingletonTrait; |
12 | 12 | |
13 | -require_once __DIR__ . "/AbstractLoader.php"; |
|
13 | +require_once __DIR__."/AbstractLoader.php"; |
|
14 | 14 | require_once realpath(__DIR__."/../../StdLib/SingletonTrait.php"); |
15 | 15 | |
16 | 16 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | $path = array_search($namespace, $paths).DIRECTORY_SEPARATOR.$className.".php"; |
40 | 40 | |
41 | - if(file_exists($path)) { |
|
41 | + if (file_exists($path)) { |
|
42 | 42 | return $path; |
43 | 43 | } |
44 | 44 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | use app\framework\Component\StdLib\SingletonTrait; |
12 | 12 | |
13 | -require __DIR__ . "/AbstractLoader.php"; |
|
13 | +require __DIR__."/AbstractLoader.php"; |
|
14 | 14 | require_once realpath(__DIR__."/../../StdLib/SingletonTrait.php"); |
15 | 15 | |
16 | 16 | /** |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | if ($this->getLastNamespacePosition($className)) { |
30 | 30 | $namespace = $this->getNamespace($className); |
31 | 31 | $className = $this->getClass($className); |
32 | - $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
32 | + $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
33 | 33 | } |
34 | - $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; |
|
34 | + $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className).'.php'; |
|
35 | 35 | |
36 | 36 | $path = ROOT_PATH.DIRECTORY_SEPARATOR.$fileName; |
37 | 37 | |
38 | - if(file_exists($path)) { |
|
38 | + if (file_exists($path)) { |
|
39 | 39 | return $path; |
40 | 40 | } |
41 | 41 |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -if(! function_exists("dd")) { |
|
2 | +if (!function_exists("dd")) { |
|
3 | 3 | /** |
4 | 4 | * Little helper called dump and die |
5 | 5 | * @param $val |
6 | 6 | */ |
7 | 7 | function dd($val) { |
8 | - \app\framework\Component\VarDumper\VarDumper::dump($val);die; |
|
8 | + \app\framework\Component\VarDumper\VarDumper::dump($val); die; |
|
9 | 9 | } |
10 | 10 | } |
11 | 11 | |
12 | -if(! function_exists("pathTo")) { |
|
12 | +if (!function_exists("pathTo")) { |
|
13 | 13 | /** |
14 | 14 | * Easy function to get the path to the project + if you want an directory in it. |
15 | 15 | * |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | -if(! function_exists("view")) { |
|
24 | +if (!function_exists("view")) { |
|
25 | 25 | /** |
26 | 26 | * Get the evaluated view contents for the given view. |
27 | 27 | * |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | * @param array $data Data to set values in template file |
30 | 30 | * @return \app\framework\Component\View\View|string |
31 | 31 | */ |
32 | - function view($view = null, $data = []) { |
|
33 | - $data['auth'] = new \app\framework\Component\Auth\Auth; |
|
32 | + function view($view = null, $data = [ ]) { |
|
33 | + $data[ 'auth' ] = new \app\framework\Component\Auth\Auth; |
|
34 | 34 | $View = new \app\framework\Component\View\View($view, $data); |
35 | 35 | return $View->render(); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -if(! function_exists("app")) { |
|
39 | +if (!function_exists("app")) { |
|
40 | 40 | /** |
41 | 41 | * Used to easily call Methods from classes without manually set |
42 | 42 | * locally Instances of them. |
@@ -45,23 +45,23 @@ discard block |
||
45 | 45 | * @param array $param To declare what parameter shall be passed to the method |
46 | 46 | * @return mixed |
47 | 47 | */ |
48 | - function app($classMethod, $param = []) { |
|
49 | - return $GLOBALS["App"]->call($classMethod, $param); |
|
48 | + function app($classMethod, $param = [ ]) { |
|
49 | + return $GLOBALS[ "App" ]->call($classMethod, $param); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -if(! function_exists("url")) { |
|
53 | +if (!function_exists("url")) { |
|
54 | 54 | /** |
55 | 55 | * Returns UrlObject with current url |
56 | 56 | * |
57 | 57 | * @return \app\framework\Component\StdLib\StdObject\UrlObject\UrlObject |
58 | 58 | */ |
59 | 59 | function url() { |
60 | - return new \app\framework\Component\StdLib\StdObject\UrlObject\UrlObject($_SERVER['HTTP_HOST']); |
|
60 | + return new \app\framework\Component\StdLib\StdObject\UrlObject\UrlObject($_SERVER[ 'HTTP_HOST' ]); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | -if(! function_exists("getStringBetween")) { |
|
64 | +if (!function_exists("getStringBetween")) { |
|
65 | 65 | /** |
66 | 66 | * This is a handy little function to strip out a string between |
67 | 67 | * two specified pieces of text. This could be used to parse |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return bool|string |
74 | 74 | */ |
75 | 75 | function getStringBetween($string, $start, $end) { |
76 | - $string = ' ' . $string; |
|
76 | + $string = ' '.$string; |
|
77 | 77 | $ini = strpos($string, $start); |
78 | 78 | if ($ini == 0) return ''; |
79 | 79 | $ini += strlen($start); |
@@ -82,31 +82,31 @@ discard block |
||
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | -if(! function_exists("handle")) { |
|
86 | - function handle( $e) { |
|
85 | +if (!function_exists("handle")) { |
|
86 | + function handle($e) { |
|
87 | 87 | \app\framework\Component\Exception\Handler::getInstance()->handler($e); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | -if(! function_exists("arr")) { |
|
91 | +if (!function_exists("arr")) { |
|
92 | 92 | /** |
93 | 93 | * Create an ArrayObject from array |
94 | 94 | * |
95 | 95 | * @param array $arr |
96 | 96 | * @return \app\framework\Component\StdLib\StdObject\ArrayObject\ArrayObject |
97 | 97 | */ |
98 | - function arr(array $arr = []) { |
|
98 | + function arr(array $arr = [ ]) { |
|
99 | 99 | return new \app\framework\Component\StdLib\StdObject\ArrayObject\ArrayObject($arr); |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | -if(! function_exists("str")) { |
|
103 | +if (!function_exists("str")) { |
|
104 | 104 | function str($str) { |
105 | 105 | return new \app\framework\Component\StdLib\StdObject\StringObject\StringObject($str); |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | -if(! function_exists("encrypt")) { |
|
109 | +if (!function_exists("encrypt")) { |
|
110 | 110 | /** |
111 | 111 | * Encrypt the given value. |
112 | 112 | * |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | \app\framework\Component\Config\Config::getInstance()->get("CrypKey") |
121 | 121 | ); |
122 | 122 | |
123 | - return $Encryptor->encrypt($value, $serialize ); |
|
123 | + return $Encryptor->encrypt($value, $serialize); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | -if(! function_exists("decrypt")) { |
|
127 | +if (!function_exists("decrypt")) { |
|
128 | 128 | /** |
129 | 129 | * Decrypt the given value. |
130 | 130 | * |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | \app\framework\Component\Config\Config::getInstance()->get("CrypKey") |
139 | 139 | ); |
140 | 140 | |
141 | - return $Encryptor->decrypt($value, $unserialize ); |
|
141 | + return $Encryptor->decrypt($value, $unserialize); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | -if(! function_exists("version")) { |
|
145 | +if (!function_exists("version")) { |
|
146 | 146 | /** |
147 | 147 | * @return string version as written in config/app.php |
148 | 148 | */ |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | -if(! function_exists("isDebug")) { |
|
154 | +if (!function_exists("isDebug")) { |
|
155 | 155 | function isDebug() { |
156 | 156 | return \app\framework\Component\Config\Config::getInstance()->get("debug", "app"); |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | -if(! function_exists("class_basename")) { |
|
160 | +if (!function_exists("class_basename")) { |
|
161 | 161 | /** |
162 | 162 | * Get the class "basename" of the given object / class. |
163 | 163 | * |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | -if (! function_exists("get_connection_log")) |
|
174 | +if (!function_exists("get_connection_log")) |
|
175 | 175 | { |
176 | 176 | /** |
177 | 177 | * returns query log from Connection as array |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | -if (! function_exists("datetime")) { |
|
188 | +if (!function_exists("datetime")) { |
|
189 | 189 | /** |
190 | 190 | * @param string $time |
191 | 191 | * @param null $timezone |