Passed
Push — master ( 4554ad...cc847b )
by Viacheslav
01:49
created
src/JsonPointer.php 2 patches
Spacing   +13 added lines, -13 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,12 +79,12 @@  discard block
 block discarded – undo
79 79
             } else { // null or array
80 80
                 $intKey = filter_var($key, FILTER_VALIDATE_INT);
81 81
                 if ($ref === null && (false === $intKey || $intKey !== 0)) {
82
-                    $key = (string)$key;
82
+                    $key = (string) $key;
83 83
                     if ($recursively) {
84 84
                         $ref = new \stdClass();
85 85
                         $ref = &$ref->{$key};
86 86
                     } else {
87
-                        throw new Exception('Non-existent path item: ' . $key);
87
+                        throw new Exception('Non-existent path item: '.$key);
88 88
                     }
89 89
                 } else {
90 90
                     if ($recursively && $ref === null) $ref = array();
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
         if (array_key_exists($key, $a)) {
117 117
             return true;
118 118
         }
119
-        $key = (string)$key;
119
+        $key = (string) $key;
120 120
         foreach ($a as $k => $v) {
121
-            if ((string)$k === $key) {
121
+            if ((string) $k === $key) {
122 122
                 return true;
123 123
             }
124 124
         }
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 
128 128
     private static function arrayGet($key, array $a)
129 129
     {
130
-        $key = (string)$key;
130
+        $key = (string) $key;
131 131
         foreach ($a as $k => $v) {
132
-            if ((string)$k === $key) {
132
+            if ((string) $k === $key) {
133 133
                 return $v;
134 134
             }
135 135
         }
@@ -153,20 +153,20 @@  discard block
 block discarded – undo
153 153
                         Exception::EMPTY_PROPERTY_NAME_UNSUPPORTED);
154 154
                 }
155 155
 
156
-                $vars = (array)$ref;
156
+                $vars = (array) $ref;
157 157
                 if (self::arrayKeyExists($key, $vars)) {
158 158
                     $ref = self::arrayGet($key, $vars);
159 159
                 } else {
160
-                    throw new Exception('Key not found: ' . $key);
160
+                    throw new Exception('Key not found: '.$key);
161 161
                 }
162 162
             } elseif (is_array($ref)) {
163 163
                 if (self::arrayKeyExists($key, $ref)) {
164 164
                     $ref = $ref[$key];
165 165
                 } else {
166
-                    throw new Exception('Key not found: ' . $key);
166
+                    throw new Exception('Key not found: '.$key);
167 167
                 }
168 168
             } else {
169
-                throw new Exception('Key not found: ' . $key);
169
+                throw new Exception('Key not found: '.$key);
170 170
             }
171 171
         }
172 172
         return $ref;
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
                 if (property_exists($ref, $key)) {
200 200
                     $ref = &$ref->$key;
201 201
                 } else {
202
-                    throw new Exception('Key not found: ' . $key);
202
+                    throw new Exception('Key not found: '.$key);
203 203
                 }
204 204
             } else {
205 205
                 if (array_key_exists($key, $ref)) {
206 206
                     $ref = &$ref[$key];
207 207
                 } else {
208
-                    throw new Exception('Key not found: ' . $key);
208
+                    throw new Exception('Key not found: '.$key);
209 209
                 }
210 210
             }
211 211
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,9 @@
 block discarded – undo
87 87
                         throw new Exception('Non-existent path item: ' . $key);
88 88
                     }
89 89
                 } else {
90
-                    if ($recursively && $ref === null) $ref = array();
90
+                    if ($recursively && $ref === null) {
91
+                        $ref = array();
92
+                    }
91 93
                     if ('-' === $key) {
92 94
                         $ref = &$ref[];
93 95
                     } else {
Please login to merge, or discard this patch.