@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | * @see ../docs/config/README.md |
| 11 | 11 | */ |
| 12 | 12 | abstract class Config extends Registry { |
| 13 | - private $locked = false; |
|
| 13 | + private $locked = false; |
|
| 14 | 14 | |
| 15 | 15 | public function __construct(array $arrayConfig = []) { |
| 16 | 16 | parent::__construct(); |
| 17 | - foreach($arrayConfig as $key => $value) |
|
| 17 | + foreach ($arrayConfig as $key => $value) |
|
| 18 | 18 | $this->offsetSet($key, $value); |
| 19 | 19 | |
| 20 | 20 | $this->onConstruct(); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function toArray() { |
| 39 | 39 | return array_map( |
| 40 | - function ($value) { |
|
| 40 | + function($value) { |
|
| 41 | 41 | return $this->hasToArray($value) ? $value->toArray() : $value; |
| 42 | 42 | }, |
| 43 | 43 | $this->rawValues() |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function __construct(array $arrayConfig = []) { |
| 16 | 16 | parent::__construct(); |
| 17 | - foreach($arrayConfig as $key => $value) |
|
| 18 | - $this->offsetSet($key, $value); |
|
| 17 | + foreach($arrayConfig as $key => $value) { |
|
| 18 | + $this->offsetSet($key, $value); |
|
| 19 | + } |
|
| 19 | 20 | |
| 20 | 21 | $this->onConstruct(); |
| 21 | 22 | } |
@@ -82,7 +83,8 @@ discard block |
||
| 82 | 83 | } |
| 83 | 84 | |
| 84 | 85 | private function blockIfLocked() { |
| 85 | - if ($this->isLocked()) |
|
| 86 | - throw new CanNotMutateException(); |
|
| 86 | + if ($this->isLocked()) { |
|
| 87 | + throw new CanNotMutateException(); |
|
| 88 | + } |
|
| 87 | 89 | } |
| 88 | 90 | } |
| 89 | 91 | \ No newline at end of file |
@@ -39,23 +39,23 @@ |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | # ArrayAccess |
| 42 | - public function offsetGet($offset) { return $this->requireOffset($offset); } |
|
| 43 | - public function offsetExists($offset) { return isset($this->values[$offset]); } |
|
| 44 | - public function offsetSet($offset, $val) { $this->values[$offset] = $val; } |
|
| 45 | - public function offsetUnset($offset) { unset($this->values[$offset]); } |
|
| 42 | + public function offsetGet($offset) { return $this->requireOffset($offset); } |
|
| 43 | + public function offsetExists($offset) { return isset($this->values[$offset]); } |
|
| 44 | + public function offsetSet($offset, $val) { $this->values[$offset] = $val; } |
|
| 45 | + public function offsetUnset($offset) { unset($this->values[$offset]); } |
|
| 46 | 46 | |
| 47 | 47 | # Iterator |
| 48 | - public function rewind() { return reset($this->values); } |
|
| 49 | - public function key() { return key($this->values); } |
|
| 50 | - public function current() { return current($this->values); } |
|
| 51 | - public function next() { return next($this->values); } |
|
| 52 | - public function valid() { return key($this->values) !== null; } |
|
| 48 | + public function rewind() { return reset($this->values); } |
|
| 49 | + public function key() { return key($this->values); } |
|
| 50 | + public function current() { return current($this->values); } |
|
| 51 | + public function next() { return next($this->values); } |
|
| 52 | + public function valid() { return key($this->values) !== null; } |
|
| 53 | 53 | |
| 54 | 54 | # Magic Property Access |
| 55 | - public function __set($offset, $value) { $this->offsetSet($offset, $value); } |
|
| 56 | - public function __unset($offset) { $this->offsetUnset($offset); } |
|
| 57 | - public function __get($offset) { return $this->offsetGet($offset); } |
|
| 58 | - public function __isset($offset) { return $this->offsetExists($offset); } |
|
| 55 | + public function __set($offset, $value) { $this->offsetSet($offset, $value); } |
|
| 56 | + public function __unset($offset) { $this->offsetUnset($offset); } |
|
| 57 | + public function __get($offset) { return $this->offsetGet($offset); } |
|
| 58 | + public function __isset($offset) { return $this->offsetExists($offset); } |
|
| 59 | 59 | |
| 60 | 60 | protected function requireOffset($offset) { |
| 61 | 61 | if (!$this->offsetExists($offset)) |
@@ -58,8 +58,9 @@ |
||
| 58 | 58 | public function __isset($offset) { return $this->offsetExists($offset); } |
| 59 | 59 | |
| 60 | 60 | protected function requireOffset($offset) { |
| 61 | - if (!$this->offsetExists($offset)) |
|
| 62 | - throw new \OutOfBoundsException("offset '{$offset}' does not exist"); |
|
| 61 | + if (!$this->offsetExists($offset)) { |
|
| 62 | + throw new \OutOfBoundsException("offset '{$offset}' does not exist"); |
|
| 63 | + } |
|
| 63 | 64 | |
| 64 | 65 | return $this->values[$offset]; |
| 65 | 66 | } |