Completed
Pull Request — master (#20)
by Viacheslav
02:49
created
src/JsonPointer.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $result = $isURIFragmentId ? '#' : '';
45 45
         foreach ($pathItems as $pathItem) {
46
-            $result .= '/' . self::escapeSegment($pathItem, $isURIFragmentId);
46
+            $result .= '/'.self::escapeSegment($pathItem, $isURIFragmentId);
47 47
         }
48 48
         return $result;
49 49
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             return self::splitPathURIFragment($pathItems);
62 62
         } else {
63 63
             if ($first !== '') {
64
-                throw new Exception('Path must start with "/": ' . $path);
64
+                throw new Exception('Path must start with "/": '.$path);
65 65
             }
66 66
             return self::splitPathJsonString($pathItems);
67 67
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                     $ref = &$ref->$key;
109 109
                 } else {
110 110
                     if (!isset($ref->$key) && count($pathItems)) {
111
-                        throw new Exception('Non-existent path item: ' . $key);
111
+                        throw new Exception('Non-existent path item: '.$key);
112 112
                     } else {
113 113
                         $ref = &$ref->$key;
114 114
                     }
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
             } else { // null or array
117 117
                 $intKey = filter_var($key, FILTER_VALIDATE_INT);
118 118
                 if ($ref === null && (false === $intKey || $intKey !== 0)) {
119
-                    $key = (string)$key;
119
+                    $key = (string) $key;
120 120
                     if ($flags & self::RECURSIVE_KEY_CREATION) {
121 121
                         $ref = new \stdClass();
122 122
                         $ref = &$ref->{$key};
123 123
                     } else {
124
-                        throw new Exception('Non-existent path item: ' . $key);
124
+                        throw new Exception('Non-existent path item: '.$key);
125 125
                     }
126 126
                 } elseif ([] === $ref && 0 === ($flags & self::STRICT_MODE) && false === $intKey && '-' !== $key) {
127 127
                     $ref = new \stdClass();
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
         if (array_key_exists($key, $a)) {
160 160
             return true;
161 161
         }
162
-        $key = (string)$key;
162
+        $key = (string) $key;
163 163
         foreach ($a as $k => $v) {
164
-            if ((string)$k === $key) {
164
+            if ((string) $k === $key) {
165 165
                 return true;
166 166
             }
167 167
         }
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
     private static function arrayGet($key, array $a)
172 172
     {
173
-        $key = (string)$key;
173
+        $key = (string) $key;
174 174
         foreach ($a as $k => $v) {
175
-            if ((string)$k === $key) {
175
+            if ((string) $k === $key) {
176 176
                 return $v;
177 177
             }
178 178
         }
@@ -196,26 +196,26 @@  discard block
 block discarded – undo
196 196
                         Exception::EMPTY_PROPERTY_NAME_UNSUPPORTED);
197 197
                 }
198 198
 
199
-                $vars = (array)$ref;
199
+                $vars = (array) $ref;
200 200
                 if (self::arrayKeyExists($key, $vars)) {
201 201
                     $ref = self::arrayGet($key, $vars);
202 202
                 } else {
203
-                    throw new Exception('Key not found: ' . $key);
203
+                    throw new Exception('Key not found: '.$key);
204 204
                 }
205 205
             } elseif (is_array($ref)) {
206 206
                 if (self::arrayKeyExists($key, $ref)) {
207 207
                     $ref = $ref[$key];
208 208
                 } else {
209
-                    throw new Exception('Key not found: ' . $key);
209
+                    throw new Exception('Key not found: '.$key);
210 210
                 }
211 211
             } elseif (is_object($ref)) {
212 212
                 if (isset($ref->$key)) {
213 213
                     $ref = $ref->$key;
214 214
                 } else {
215
-                    throw new Exception('Key not found: ' . $key);
215
+                    throw new Exception('Key not found: '.$key);
216 216
                 }
217 217
             } else {
218
-                throw new Exception('Key not found: ' . $key);
218
+                throw new Exception('Key not found: '.$key);
219 219
             }
220 220
         }
221 221
         return $ref;
@@ -248,19 +248,19 @@  discard block
 block discarded – undo
248 248
                 if (property_exists($ref, $key)) {
249 249
                     $ref = &$ref->$key;
250 250
                 } else {
251
-                    throw new Exception('Key not found: ' . $key);
251
+                    throw new Exception('Key not found: '.$key);
252 252
                 }
253 253
             } elseif (is_object($ref)) {
254 254
                 if (isset($ref->$key)) {
255 255
                     $ref = &$ref->$key;
256 256
                 } else {
257
-                    throw new Exception('Key not found: ' . $key);
257
+                    throw new Exception('Key not found: '.$key);
258 258
                 }
259 259
             } else {
260 260
                 if (array_key_exists($key, $ref)) {
261 261
                     $ref = &$ref[$key];
262 262
                 } else {
263
-                    throw new Exception('Key not found: ' . $key);
263
+                    throw new Exception('Key not found: '.$key);
264 264
                 }
265 265
             }
266 266
         }
Please login to merge, or discard this patch.