@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function path($add = null) |
| 27 | 27 | { |
| 28 | - return $add ? $this->path != null ? $this->path . self::$ARRAY_PATH_DELIMITER . $add : $add : $this->path; |
|
| 28 | + return $add ? $this->path != null ? $this->path.self::$ARRAY_PATH_DELIMITER.$add : $add : $this->path; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $arguments = func_get_args(); |
| 83 | 83 | |
| 84 | - if ( isset( $arguments[1] ) ) |
|
| 84 | + if (isset($arguments[1])) |
|
| 85 | 85 | { |
| 86 | 86 | $default_return = $arguments[1]; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - $target_data =& $this->data; |
|
| 89 | + $target_data = & $this->data; |
|
| 90 | 90 | |
| 91 | 91 | foreach (static::pathParser($path) as $way) |
| 92 | 92 | { |
| 93 | 93 | |
| 94 | - if ( ! isset( $target_data[$way] ) ) |
|
| 94 | + if ( ! isset($target_data[$way])) |
|
| 95 | 95 | { |
| 96 | 96 | |
| 97 | - if ( isset( $default_return ) ) |
|
| 97 | + if (isset($default_return)) |
|
| 98 | 98 | { |
| 99 | 99 | $r = $this->set($path, $default_return); |
| 100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $target_data = &$target_data[$way]; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if ( is_array($target_data) ) |
|
| 110 | + if (is_array($target_data)) |
|
| 111 | 111 | { |
| 112 | 112 | return new ChildDict($target_data, $this->childParent(), $path); |
| 113 | 113 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $arguments = func_get_args(); |
| 130 | 130 | |
| 131 | - if ( isset( $arguments[1] ) ) |
|
| 131 | + if (isset($arguments[1])) |
|
| 132 | 132 | { |
| 133 | 133 | $value = $arguments[1]; |
| 134 | 134 | } |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | catch (WrongArrayPathException $e) |
| 141 | 141 | { |
| 142 | - if ( isset( $value ) ) |
|
| 142 | + if (isset($value)) |
|
| 143 | 143 | { |
| 144 | - return $this->value($value, [ $path ]); |
|
| 144 | + return $this->value($value, [$path]); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | throw $e; |
@@ -157,24 +157,24 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function set($rawPath, $value) |
| 159 | 159 | { |
| 160 | - $target_data =& $this->data; |
|
| 160 | + $target_data = & $this->data; |
|
| 161 | 161 | |
| 162 | 162 | foreach (static::pathParser($rawPath) as $path) |
| 163 | 163 | { |
| 164 | 164 | // If there is no way to go or this is not an array! |
| 165 | - if ( ! isset( $target_data[$path] ) || ! is_array($target_data[$path]) ) |
|
| 165 | + if ( ! isset($target_data[$path]) || ! is_array($target_data[$path])) |
|
| 166 | 166 | { |
| 167 | - $target_data[$path] = [ ]; |
|
| 167 | + $target_data[$path] = []; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - $target_data =& $target_data[$path]; |
|
| 170 | + $target_data = & $target_data[$path]; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $value = $this->value($value, [ $rawPath ]); |
|
| 173 | + $value = $this->value($value, [$rawPath]); |
|
| 174 | 174 | |
| 175 | 175 | $target_data = $value; |
| 176 | 176 | |
| 177 | - if ( is_array($target_data) ) |
|
| 177 | + if (is_array($target_data)) |
|
| 178 | 178 | { |
| 179 | 179 | return new ChildDict($target_data, $this->childParent(), $this->path()); |
| 180 | 180 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function del($rawPath) |
| 192 | 192 | { |
| 193 | - $target_data =& $this->data; |
|
| 193 | + $target_data = & $this->data; |
|
| 194 | 194 | |
| 195 | 195 | $paths = static::pathParser($rawPath); |
| 196 | 196 | |
@@ -199,24 +199,24 @@ discard block |
||
| 199 | 199 | foreach ($paths as $path) |
| 200 | 200 | { |
| 201 | 201 | // If there is no way to go or this is not an array! |
| 202 | - if ( ! isset( $target_data[$path] ) || ! is_array($target_data[$path]) ) |
|
| 202 | + if ( ! isset($target_data[$path]) || ! is_array($target_data[$path])) |
|
| 203 | 203 | { |
| 204 | 204 | return $this; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - $target_data =& $target_data[$path]; |
|
| 207 | + $target_data = & $target_data[$path]; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ( isset( $target_data[$target_key] ) ) |
|
| 210 | + if (isset($target_data[$target_key])) |
|
| 211 | 211 | { |
| 212 | - unset( $target_data[$target_key] ); |
|
| 212 | + unset($target_data[$target_key]); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | return $this; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | |
| 219 | - protected function value($value, array $arguments = [ ]) |
|
| 219 | + protected function value($value, array $arguments = []) |
|
| 220 | 220 | { |
| 221 | 221 | return $value instanceof \Closure ? call_user_func_array($value, $arguments) : $value; |
| 222 | 222 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function __construct(array &$data, AbstractDictBody $parent = null, $path = '') |
| 50 | 50 | { |
| 51 | - $this->data =& $data; |
|
| 51 | + $this->data = & $data; |
|
| 52 | 52 | $this->path = $path; |
| 53 | 53 | $this->parentArray = $parent; |
| 54 | 54 | } |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function &__get($key) |
| 74 | 74 | { |
| 75 | - if ( array_key_exists($key, $this->data) ) |
|
| 75 | + if (array_key_exists($key, $this->data)) |
|
| 76 | 76 | { |
| 77 | - $target =& $this->data[$key]; |
|
| 77 | + $target = & $this->data[$key]; |
|
| 78 | 78 | } |
| 79 | 79 | else |
| 80 | 80 | { |
| 81 | 81 | throw new WrongArrayPathException($key); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if ( is_array($target) ) |
|
| 84 | + if (is_array($target)) |
|
| 85 | 85 | { |
| 86 | 86 | $r = new ChildDict($target, $this->childParent(), $this->path($key)); |
| 87 | 87 | |
@@ -101,18 +101,18 @@ discard block |
||
| 101 | 101 | * @return mixed |
| 102 | 102 | * @throws \Exception |
| 103 | 103 | */ |
| 104 | - public function call($methodPath, array $arguments = [ ]) |
|
| 104 | + public function call($methodPath, array $arguments = []) |
|
| 105 | 105 | { |
| 106 | 106 | $function = $this->get($methodPath, false); |
| 107 | 107 | |
| 108 | - if ( ! $function || ! is_callable($function) ) |
|
| 108 | + if ( ! $function || ! is_callable($function)) |
|
| 109 | 109 | { |
| 110 | 110 | throw new WrongFunctionException("Wrong function or not callable key!"); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | try |
| 114 | 114 | { |
| 115 | - $arguments = array_merge([ &$this->data ], $arguments); |
|
| 115 | + $arguments = array_merge([&$this->data], $arguments); |
|
| 116 | 116 | |
| 117 | 117 | return call_user_func_array($function, $arguments); |
| 118 | 118 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @return $this|mixed |
| 133 | 133 | * @throws \Exception|WrongFunctionException |
| 134 | 134 | */ |
| 135 | - public function __call($method, $arguments = [ ]) |
|
| 135 | + public function __call($method, $arguments = []) |
|
| 136 | 136 | { |
| 137 | 137 | try |
| 138 | 138 | { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function __isset($key) |
| 154 | 154 | { |
| 155 | - return isset( $this->data[$key] ); |
|
| 155 | + return isset($this->data[$key]); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function __unset($key) |
| 163 | 163 | { |
| 164 | - unset( $this->data[$key] ); |
|
| 164 | + unset($this->data[$key]); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public function keyExists($key) |
| 189 | 189 | { |
| 190 | - return isset( $this->data[$key] ); |
|
| 190 | + return isset($this->data[$key]); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |