@@ -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 | } |
@@ -48,8 +49,9 @@ discard block |
||
| 48 | 49 | public function path($path, $default = null, $delimiter = '.') { |
| 49 | 50 | $tokens = explode($delimiter, $path); |
| 50 | 51 | $token = array_shift($tokens); |
| 51 | - if ($this->get($token) instanceof self) |
|
| 52 | - return $this[$token]->path(implode('.', $tokens), $default); |
|
| 52 | + if ($this->get($token) instanceof self) { |
|
| 53 | + return $this[$token]->path(implode('.', $tokens), $default); |
|
| 54 | + } |
|
| 53 | 55 | return $this->get($token, $default); |
| 54 | 56 | } |
| 55 | 57 | |
@@ -66,8 +68,9 @@ discard block |
||
| 66 | 68 | } |
| 67 | 69 | |
| 68 | 70 | public function offsetGet($offset) { |
| 69 | - if (!$this->offsetExists($offset)) |
|
| 70 | - throw new \OutOfBoundsException("offset '{$offset}' does not exist"); |
|
| 71 | + if (!$this->offsetExists($offset)) { |
|
| 72 | + throw new \OutOfBoundsException("offset '{$offset}' does not exist"); |
|
| 73 | + } |
|
| 71 | 74 | return $this->values[$offset]; |
| 72 | 75 | } |
| 73 | 76 | |
@@ -119,7 +122,8 @@ discard block |
||
| 119 | 122 | } |
| 120 | 123 | |
| 121 | 124 | private function blockIfLocked() { |
| 122 | - if ($this->isLocked()) |
|
| 123 | - throw new CanNotMutateException(); |
|
| 125 | + if ($this->isLocked()) { |
|
| 126 | + throw new CanNotMutateException(); |
|
| 127 | + } |
|
| 124 | 128 | } |
| 125 | 129 | } |
| 126 | 130 | \ 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->extractValue($value); |
| 40 | 40 | }, |
| 41 | 41 | $this->values |
@@ -96,18 +96,18 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | # Iterator |
| 99 | - public function rewind() { return reset($this->values); } |
|
| 100 | - public function key() { return key($this->values); } |
|
| 101 | - public function current() { return current($this->values); } |
|
| 102 | - public function next() { return next($this->values); } |
|
| 103 | - public function valid() { return key($this->values) !== null; } |
|
| 99 | + public function rewind() { return reset($this->values); } |
|
| 100 | + public function key() { return key($this->values); } |
|
| 101 | + public function current() { return current($this->values); } |
|
| 102 | + public function next() { return next($this->values); } |
|
| 103 | + public function valid() { return key($this->values) !== null; } |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | # Magic Property Access |
| 107 | - public function __set($offset, $value) { $this->offsetSet($offset, $value); } |
|
| 108 | - public function __unset($offset) { $this->offsetUnset($offset); } |
|
| 109 | - public function __get($offset) { return $this->offsetGet($offset); } |
|
| 110 | - public function __isset($offset) { return $this->offsetExists($offset); } |
|
| 107 | + public function __set($offset, $value) { $this->offsetSet($offset, $value); } |
|
| 108 | + public function __unset($offset) { $this->offsetUnset($offset); } |
|
| 109 | + public function __get($offset) { return $this->offsetGet($offset); } |
|
| 110 | + public function __isset($offset) { return $this->offsetExists($offset); } |
|
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * @param array $data |