@@ -37,7 +37,9 @@ |
||
| 37 | 37 | |
| 38 | 38 | private function nextNumericIndex() { |
| 39 | 39 | $numericKeys = array_filter(array_keys($this->rawValues()), 'is_numeric'); |
| 40 | - if (count($numericKeys) === 0) return 0; |
|
| 40 | + if (count($numericKeys) === 0) { |
|
| 41 | + return 0; |
|
| 42 | + } |
|
| 41 | 43 | return max($numericKeys) + 1; |
| 42 | 44 | } |
| 43 | 45 | } |
| 44 | 46 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | private $values = []; |
| 13 | 13 | |
| 14 | 14 | public function __construct(array $arrayConfig = []) { |
| 15 | - foreach($arrayConfig as $key => $value) |
|
| 15 | + foreach ($arrayConfig as $key => $value) |
|
| 16 | 16 | $this->offsetSet($key, $value); |
| 17 | 17 | |
| 18 | 18 | $this->onConstruct(); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function toArray() { |
| 37 | 37 | return array_map( |
| 38 | - function ($value) { |
|
| 38 | + function($value) { |
|
| 39 | 39 | return $this->hasToArray($value) ? $value->toArray() : $value; |
| 40 | 40 | }, |
| 41 | 41 | $this->values |
@@ -86,18 +86,18 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | # Iterator |
| 89 | - public function rewind() { return reset($this->values); } |
|
| 90 | - public function key() { return key($this->values); } |
|
| 91 | - public function current() { return current($this->values); } |
|
| 92 | - public function next() { return next($this->values); } |
|
| 93 | - public function valid() { return key($this->values) !== null; } |
|
| 89 | + public function rewind() { return reset($this->values); } |
|
| 90 | + public function key() { return key($this->values); } |
|
| 91 | + public function current() { return current($this->values); } |
|
| 92 | + public function next() { return next($this->values); } |
|
| 93 | + public function valid() { return key($this->values) !== null; } |
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | # Magic Property Access |
| 97 | - public function __set($offset, $value) { $this->offsetSet($offset, $value); } |
|
| 98 | - public function __unset($offset) { $this->offsetUnset($offset); } |
|
| 99 | - public function __get($offset) { return $this->offsetGet($offset); } |
|
| 100 | - public function __isset($offset) { return $this->offsetExists($offset); } |
|
| 97 | + public function __set($offset, $value) { $this->offsetSet($offset, $value); } |
|
| 98 | + public function __unset($offset) { $this->offsetUnset($offset); } |
|
| 99 | + public function __get($offset) { return $this->offsetGet($offset); } |
|
| 100 | + public function __isset($offset) { return $this->offsetExists($offset); } |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * @param array $data |
@@ -12,8 +12,9 @@ discard block |
||
| 12 | 12 | private $values = []; |
| 13 | 13 | |
| 14 | 14 | public function __construct(array $arrayConfig = []) { |
| 15 | - foreach($arrayConfig as $key => $value) |
|
| 16 | - $this->offsetSet($key, $value); |
|
| 15 | + foreach($arrayConfig as $key => $value) { |
|
| 16 | + $this->offsetSet($key, $value); |
|
| 17 | + } |
|
| 17 | 18 | |
| 18 | 19 | $this->onConstruct(); |
| 19 | 20 | } |
@@ -47,8 +48,9 @@ discard block |
||
| 47 | 48 | } |
| 48 | 49 | |
| 49 | 50 | public function path($path, $default = null, $delimiter = '.') { |
| 50 | - if ($this->pathStartsWithConfig($path, $delimiter)) |
|
| 51 | - return $this->evalSubPath($path, $delimiter, $default); |
|
| 51 | + if ($this->pathStartsWithConfig($path, $delimiter)) { |
|
| 52 | + return $this->evalSubPath($path, $delimiter, $default); |
|
| 53 | + } |
|
| 52 | 54 | |
| 53 | 55 | return $this->get($this->getFirstToken($path, $delimiter), $default); |
| 54 | 56 | } |
@@ -107,8 +109,9 @@ discard block |
||
| 107 | 109 | } |
| 108 | 110 | |
| 109 | 111 | public function offsetGet($offset) { |
| 110 | - if (!$this->offsetExists($offset)) |
|
| 111 | - throw new \OutOfBoundsException("offset '{$offset}' does not exist"); |
|
| 112 | + if (!$this->offsetExists($offset)) { |
|
| 113 | + throw new \OutOfBoundsException("offset '{$offset}' does not exist"); |
|
| 114 | + } |
|
| 112 | 115 | return $this->values[$offset]; |
| 113 | 116 | } |
| 114 | 117 | |
@@ -160,7 +163,8 @@ discard block |
||
| 160 | 163 | } |
| 161 | 164 | |
| 162 | 165 | private function blockIfLocked() { |
| 163 | - if ($this->isLocked()) |
|
| 164 | - throw new CanNotMutateException(); |
|
| 166 | + if ($this->isLocked()) { |
|
| 167 | + throw new CanNotMutateException(); |
|
| 168 | + } |
|
| 165 | 169 | } |
| 166 | 170 | } |
| 167 | 171 | \ No newline at end of file |