Completed
Push — master ( cc847b...44b707 )
by Viacheslav
03:28
created
src/JsonPointer.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             return self::splitPathURIFragment($pathItems);
33 33
         } else {
34 34
             if ($first !== '') {
35
-                throw new Exception('Path must start with "/": ' . $path);
35
+                throw new Exception('Path must start with "/": '.$path);
36 36
             }
37 37
             return self::splitPathJsonString($pathItems);
38 38
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                     $ref = &$ref->$key;
80 80
                 } else {
81 81
                     if (!isset($ref->$key) && count($pathItems)) {
82
-                        throw new Exception('Non-existent path item: ' . $key);
82
+                        throw new Exception('Non-existent path item: '.$key);
83 83
                     } else {
84 84
                         $ref = &$ref->$key;
85 85
                     }
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
             } else { // null or array
88 88
                 $intKey = filter_var($key, FILTER_VALIDATE_INT);
89 89
                 if ($ref === null && (false === $intKey || $intKey !== 0)) {
90
-                    $key = (string)$key;
90
+                    $key = (string) $key;
91 91
                     if ($recursively) {
92 92
                         $ref = new \stdClass();
93 93
                         $ref = &$ref->{$key};
94 94
                     } else {
95
-                        throw new Exception('Non-existent path item: ' . $key);
95
+                        throw new Exception('Non-existent path item: '.$key);
96 96
                     }
97 97
                 } else {
98 98
                     if ($recursively && $ref === null) $ref = array();
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
         if (array_key_exists($key, $a)) {
125 125
             return true;
126 126
         }
127
-        $key = (string)$key;
127
+        $key = (string) $key;
128 128
         foreach ($a as $k => $v) {
129
-            if ((string)$k === $key) {
129
+            if ((string) $k === $key) {
130 130
                 return true;
131 131
             }
132 132
         }
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 
136 136
     private static function arrayGet($key, array $a)
137 137
     {
138
-        $key = (string)$key;
138
+        $key = (string) $key;
139 139
         foreach ($a as $k => $v) {
140
-            if ((string)$k === $key) {
140
+            if ((string) $k === $key) {
141 141
                 return $v;
142 142
             }
143 143
         }
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
                         Exception::EMPTY_PROPERTY_NAME_UNSUPPORTED);
162 162
                 }
163 163
 
164
-                $vars = (array)$ref;
164
+                $vars = (array) $ref;
165 165
                 if (self::arrayKeyExists($key, $vars)) {
166 166
                     $ref = self::arrayGet($key, $vars);
167 167
                 } else {
168
-                    throw new Exception('Key not found: ' . $key);
168
+                    throw new Exception('Key not found: '.$key);
169 169
                 }
170 170
             } elseif (is_array($ref)) {
171 171
                 if (self::arrayKeyExists($key, $ref)) {
172 172
                     $ref = $ref[$key];
173 173
                 } else {
174
-                    throw new Exception('Key not found: ' . $key);
174
+                    throw new Exception('Key not found: '.$key);
175 175
                 }
176 176
             } else {
177
-                throw new Exception('Key not found: ' . $key);
177
+                throw new Exception('Key not found: '.$key);
178 178
             }
179 179
         }
180 180
         return $ref;
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
                 if (property_exists($ref, $key)) {
208 208
                     $ref = &$ref->$key;
209 209
                 } else {
210
-                    throw new Exception('Key not found: ' . $key);
210
+                    throw new Exception('Key not found: '.$key);
211 211
                 }
212 212
             } else {
213 213
                 if (array_key_exists($key, $ref)) {
214 214
                     $ref = &$ref[$key];
215 215
                 } else {
216
-                    throw new Exception('Key not found: ' . $key);
216
+                    throw new Exception('Key not found: '.$key);
217 217
                 }
218 218
             }
219 219
         }
Please login to merge, or discard this patch.