@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $result = $isURIFragmentId ? '#' : ''; |
40 | 40 | foreach ($pathItems as $pathItem) { |
41 | - $result .= '/' . self::escapeSegment($pathItem, $isURIFragmentId); |
|
41 | + $result .= '/'.self::escapeSegment($pathItem, $isURIFragmentId); |
|
42 | 42 | } |
43 | 43 | return $result; |
44 | 44 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return self::splitPathURIFragment($pathItems); |
57 | 57 | } else { |
58 | 58 | if ($first !== '') { |
59 | - throw new Exception('Path must start with "/": ' . $path); |
|
59 | + throw new Exception('Path must start with "/": '.$path); |
|
60 | 60 | } |
61 | 61 | return self::splitPathJsonString($pathItems); |
62 | 62 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $ref = &$ref->$key; |
104 | 104 | } else { |
105 | 105 | if (!isset($ref->$key) && count($pathItems)) { |
106 | - throw new Exception('Non-existent path item: ' . $key); |
|
106 | + throw new Exception('Non-existent path item: '.$key); |
|
107 | 107 | } else { |
108 | 108 | $ref = &$ref->$key; |
109 | 109 | } |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | } else { // null or array |
112 | 112 | $intKey = filter_var($key, FILTER_VALIDATE_INT); |
113 | 113 | if ($ref === null && (false === $intKey || $intKey !== 0)) { |
114 | - $key = (string)$key; |
|
114 | + $key = (string) $key; |
|
115 | 115 | if ($flags & self::RECURSIVE_KEY_CREATION) { |
116 | 116 | $ref = new \stdClass(); |
117 | 117 | $ref = &$ref->{$key}; |
118 | 118 | } else { |
119 | - throw new Exception('Non-existent path item: ' . $key); |
|
119 | + throw new Exception('Non-existent path item: '.$key); |
|
120 | 120 | } |
121 | 121 | } elseif ([] === $ref && 0 === ($flags & self::STRICT_MODE) && false === $intKey && '-' !== $key) { |
122 | 122 | $ref = new \stdClass(); |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | if (array_key_exists($key, $a)) { |
152 | 152 | return true; |
153 | 153 | } |
154 | - $key = (string)$key; |
|
154 | + $key = (string) $key; |
|
155 | 155 | foreach ($a as $k => $v) { |
156 | - if ((string)$k === $key) { |
|
156 | + if ((string) $k === $key) { |
|
157 | 157 | return true; |
158 | 158 | } |
159 | 159 | } |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | |
163 | 163 | private static function arrayGet($key, array $a) |
164 | 164 | { |
165 | - $key = (string)$key; |
|
165 | + $key = (string) $key; |
|
166 | 166 | foreach ($a as $k => $v) { |
167 | - if ((string)$k === $key) { |
|
167 | + if ((string) $k === $key) { |
|
168 | 168 | return $v; |
169 | 169 | } |
170 | 170 | } |
@@ -188,20 +188,20 @@ discard block |
||
188 | 188 | Exception::EMPTY_PROPERTY_NAME_UNSUPPORTED); |
189 | 189 | } |
190 | 190 | |
191 | - $vars = (array)$ref; |
|
191 | + $vars = (array) $ref; |
|
192 | 192 | if (self::arrayKeyExists($key, $vars)) { |
193 | 193 | $ref = self::arrayGet($key, $vars); |
194 | 194 | } else { |
195 | - throw new Exception('Key not found: ' . $key); |
|
195 | + throw new Exception('Key not found: '.$key); |
|
196 | 196 | } |
197 | 197 | } elseif (is_array($ref)) { |
198 | 198 | if (self::arrayKeyExists($key, $ref)) { |
199 | 199 | $ref = $ref[$key]; |
200 | 200 | } else { |
201 | - throw new Exception('Key not found: ' . $key); |
|
201 | + throw new Exception('Key not found: '.$key); |
|
202 | 202 | } |
203 | 203 | } else { |
204 | - throw new Exception('Key not found: ' . $key); |
|
204 | + throw new Exception('Key not found: '.$key); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | return $ref; |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | if (property_exists($ref, $key)) { |
235 | 235 | $ref = &$ref->$key; |
236 | 236 | } else { |
237 | - throw new Exception('Key not found: ' . $key); |
|
237 | + throw new Exception('Key not found: '.$key); |
|
238 | 238 | } |
239 | 239 | } else { |
240 | 240 | if (array_key_exists($key, $ref)) { |
241 | 241 | $ref = &$ref[$key]; |
242 | 242 | } else { |
243 | - throw new Exception('Key not found: ' . $key); |
|
243 | + throw new Exception('Key not found: '.$key); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | } |
@@ -122,7 +122,9 @@ |
||
122 | 122 | $ref = new \stdClass(); |
123 | 123 | $ref = &$ref->{$key}; |
124 | 124 | } else { |
125 | - if ($flags & self::RECURSIVE_KEY_CREATION && $ref === null) $ref = array(); |
|
125 | + if ($flags & self::RECURSIVE_KEY_CREATION && $ref === null) { |
|
126 | + $ref = array(); |
|
127 | + } |
|
126 | 128 | if ('-' === $key) { |
127 | 129 | $ref = &$ref[]; |
128 | 130 | } else { |