@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * A Container that turns methods into magic properties |
17 | 17 | */ |
18 | -trait Magic{ |
|
18 | +trait Magic { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @param string $name |
22 | 22 | * |
23 | 23 | * @return mixed|null |
24 | 24 | */ |
25 | - public function __get(string $name){ |
|
25 | + public function __get(string $name) { |
|
26 | 26 | return $this->get($name); |
27 | 27 | } |
28 | 28 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return mixed|null |
43 | 43 | */ |
44 | - private function get(string $name){ |
|
44 | + private function get(string $name) { |
|
45 | 45 | $method = 'magic_get_'.$name; |
46 | 46 | |
47 | 47 | return method_exists($this, $method) ? $this->$method() : null; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | private function set(string $name, $value):void{ |
57 | 57 | $method = 'magic_set_'.$name; |
58 | 58 | |
59 | - if(method_exists($this, $method)){ |
|
59 | + if (method_exists($this, $method)) { |
|
60 | 60 | $this->$method($value); |
61 | 61 | } |
62 | 62 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @link http://php.net/manual/class.seekableiterator.php |
23 | 23 | */ |
24 | -trait SeekableIteratorTrait{ |
|
24 | +trait SeekableIteratorTrait { |
|
25 | 25 | use IteratorTrait; |
26 | 26 | |
27 | 27 | /** |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | public function seek($pos):void{ |
32 | 32 | $this->rewind(); |
33 | 33 | |
34 | - for( ; $this->offset < $pos; ){ |
|
34 | + for (; $this->offset < $pos;) { |
|
35 | 35 | |
36 | - if(!next($this->array)) { |
|
36 | + if (!next($this->array)) { |
|
37 | 37 | throw new OutOfBoundsException('invalid seek position: '.$pos); |
38 | 38 | } |
39 | 39 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | use ArrayIterator, ArrayObject, RecursiveArrayIterator, RecursiveIteratorIterator, Traversable; |
16 | 16 | |
17 | -trait SearchableArray{ |
|
17 | +trait SearchableArray { |
|
18 | 18 | use DotArray; |
19 | 19 | |
20 | 20 | /** |
@@ -27,19 +27,19 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param array|object|\Traversable|\ArrayIterator|\ArrayObject|null $array |
29 | 29 | */ |
30 | - public function __construct($array = null){ |
|
30 | + public function __construct($array = null) { |
|
31 | 31 | |
32 | - if(($array instanceof ArrayObject) || ($array instanceof ArrayIterator)){ |
|
32 | + if (($array instanceof ArrayObject) || ($array instanceof ArrayIterator)) { |
|
33 | 33 | $this->array = $array->getArrayCopy(); // @codeCoverageIgnore |
34 | 34 | } |
35 | - elseif($array instanceof Traversable){ |
|
35 | + elseif ($array instanceof Traversable) { |
|
36 | 36 | $this->array = iterator_to_array($array); // @codeCoverageIgnore |
37 | 37 | } |
38 | 38 | // yields unexpected results with DotArray |
39 | - elseif(gettype($array) === 'object'){ |
|
39 | + elseif (gettype($array) === 'object') { |
|
40 | 40 | $this->array = get_object_vars($array); // @codeCoverageIgnore |
41 | 41 | } |
42 | - elseif(is_array($array)){ |
|
42 | + elseif (is_array($array)) { |
|
43 | 43 | $this->array = $array; |
44 | 44 | } |
45 | 45 | |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return mixed |
56 | 56 | */ |
57 | - public function searchByKey(string $dotKey){ |
|
57 | + public function searchByKey(string $dotKey) { |
|
58 | 58 | |
59 | - foreach($this->iterator as $v){ |
|
59 | + foreach ($this->iterator as $v) { |
|
60 | 60 | |
61 | - if($this->getPath() === $dotKey){ |
|
61 | + if ($this->getPath() === $dotKey) { |
|
62 | 62 | return $v; |
63 | 63 | } |
64 | 64 | |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | |
77 | 77 | $matches = []; |
78 | 78 | |
79 | - foreach($this->iterator as $v){ |
|
79 | + foreach ($this->iterator as $v) { |
|
80 | 80 | |
81 | - if($v === $value){ |
|
81 | + if ($v === $value) { |
|
82 | 82 | $matches[$this->getPath()] = $value; |
83 | 83 | } |
84 | 84 | |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function isset(string $dotKey):bool{ |
96 | 96 | |
97 | - foreach($this->iterator as $v){ |
|
97 | + foreach ($this->iterator as $v) { |
|
98 | 98 | |
99 | - if($this->getPath() === $dotKey){ |
|
99 | + if ($this->getPath() === $dotKey) { |
|
100 | 100 | return true; |
101 | 101 | } |
102 | 102 |
@@ -31,15 +31,13 @@ |
||
31 | 31 | |
32 | 32 | if(($array instanceof ArrayObject) || ($array instanceof ArrayIterator)){ |
33 | 33 | $this->array = $array->getArrayCopy(); // @codeCoverageIgnore |
34 | - } |
|
35 | - elseif($array instanceof Traversable){ |
|
34 | + } elseif($array instanceof Traversable){ |
|
36 | 35 | $this->array = iterator_to_array($array); // @codeCoverageIgnore |
37 | 36 | } |
38 | 37 | // yields unexpected results with DotArray |
39 | 38 | elseif(gettype($array) === 'object'){ |
40 | 39 | $this->array = get_object_vars($array); // @codeCoverageIgnore |
41 | - } |
|
42 | - elseif(is_array($array)){ |
|
40 | + } elseif(is_array($array)){ |
|
43 | 41 | $this->array = $array; |
44 | 42 | } |
45 | 43 |