Completed
Push — master ( 94925e...81a403 )
by Viacheslav
11s
created
src/JsonDiff.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             if ($isArray) {
248 248
                 $actualKey -= $removedOffset;
249 249
             }
250
-            $this->path .= '/' . JsonPointer::escapeSegment($actualKey, $this->options & self::JSON_URI_FRAGMENT_ID);
250
+            $this->path .= '/'.JsonPointer::escapeSegment($actualKey, $this->options & self::JSON_URI_FRAGMENT_ID);
251 251
             $this->pathItems[] = $actualKey;
252 252
 
253 253
             if (array_key_exists($key, $newArray)) {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                 return null;
279 279
             }
280 280
             $newOrdered[$key] = $value;
281
-            $path = $this->path . '/' . JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
281
+            $path = $this->path.'/'.JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
282 282
             $pathItems = $this->pathItems;
283 283
             $pathItems[] = $key;
284 284
             JsonPointer::add($this->added, $pathItems, $value);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
         }
290 290
 
291
-        return is_array($new) ? $newOrdered : (object)$newOrdered;
291
+        return is_array($new) ? $newOrdered : (object) $newOrdered;
292 292
     }
293 293
 
294 294
     private function rearrangeArray(array $original, array $new)
Please login to merge, or discard this patch.
src/JsonValueReplace.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
             $path = $this->path;
46 46
             $pathItems = $this->pathItems;
47 47
             $actualKey = $key;
48
-            $this->path .= '/' . JsonPointer::escapeSegment($actualKey);
48
+            $this->path .= '/'.JsonPointer::escapeSegment($actualKey);
49 49
             $this->pathItems[] = $actualKey;
50 50
 
51 51
             $result[$key] = $this->process($originalValue);
@@ -54,6 +54,6 @@  discard block
 block discarded – undo
54 54
             $this->pathItems = $pathItems;
55 55
         }
56 56
 
57
-        return $data instanceof \stdClass ? (object)$result : $result;
57
+        return $data instanceof \stdClass ? (object) $result : $result;
58 58
     }
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
src/JsonPatch.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         foreach ($data as $operation) {
34 34
             /** @var OpPath|OpPathValue|OpPathFrom $operation */
35 35
             if (is_array($operation)) {
36
-                $operation = (object)$operation;
36
+                $operation = (object) $operation;
37 37
             }
38 38
 
39 39
             if (!isset($operation->op)) {
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
                     $op = new Test();
65 65
                     break;
66 66
                 default:
67
-                    throw new Exception('Unknown "op": ' . $operation->op);
67
+                    throw new Exception('Unknown "op": '.$operation->op);
68 68
             }
69 69
             $op->path = $operation->path;
70 70
             if ($op instanceof OpPathValue) {
71
-                if (!array_key_exists('value', (array)$operation)) {
71
+                if (!array_key_exists('value', (array) $operation)) {
72 72
                     throw new Exception('Missing "value" in operation data');
73 73
                 }
74 74
                 $op->value = $operation->value;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $result = array();
89 89
         foreach ($patch->operations as $operation) {
90
-            $result[] = (object)(array)$operation;
90
+            $result[] = (object) (array) $operation;
91 91
         }
92 92
 
93 93
         return $result;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
                         $diff = new JsonDiff($operation->value, $value,
145 145
                             JsonDiff::STOP_ON_DIFF);
146 146
                         if ($diff->getDiffCnt() !== 0) {
147
-                            throw new Exception('Test operation ' . json_encode($operation, JSON_UNESCAPED_SLASHES)
148
-                                . ' failed: ' . json_encode($value));
147
+                            throw new Exception('Test operation '.json_encode($operation, JSON_UNESCAPED_SLASHES)
148
+                                . ' failed: '.json_encode($value));
149 149
                         }
150 150
                         break;
151 151
                 }
Please login to merge, or discard this patch.
src/JsonPointer.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,9 @@
 block discarded – undo
112 112
                     $ref = new \stdClass();
113 113
                     $ref = &$ref->{$key};
114 114
                 } else {
115
-                    if ($recursively && $ref === null) $ref = array();
115
+                    if ($recursively && $ref === null) {
116
+                        $ref = array();
117
+                    }
116 118
                     if ('-' === $key) {
117 119
                         $ref = &$ref[];
118 120
                     } else {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     {
29 29
         $result = $isURIFragmentId ? '#' : '';
30 30
         foreach ($pathItems as $pathItem) {
31
-            $result .= '/' . self::escapeSegment($pathItem, $isURIFragmentId);
31
+            $result .= '/'.self::escapeSegment($pathItem, $isURIFragmentId);
32 32
         }
33 33
         return $result;
34 34
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             return self::splitPathURIFragment($pathItems);
47 47
         } else {
48 48
             if ($first !== '') {
49
-                throw new Exception('Path must start with "/": ' . $path);
49
+                throw new Exception('Path must start with "/": '.$path);
50 50
             }
51 51
             return self::splitPathJsonString($pathItems);
52 52
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     $ref = &$ref->$key;
94 94
                 } else {
95 95
                     if (!isset($ref->$key) && count($pathItems)) {
96
-                        throw new Exception('Non-existent path item: ' . $key);
96
+                        throw new Exception('Non-existent path item: '.$key);
97 97
                     } else {
98 98
                         $ref = &$ref->$key;
99 99
                     }
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
             } else { // null or array
102 102
                 $intKey = filter_var($key, FILTER_VALIDATE_INT);
103 103
                 if ($ref === null && (false === $intKey || $intKey !== 0)) {
104
-                    $key = (string)$key;
104
+                    $key = (string) $key;
105 105
                     if ($recursively) {
106 106
                         $ref = new \stdClass();
107 107
                         $ref = &$ref->{$key};
108 108
                     } else {
109
-                        throw new Exception('Non-existent path item: ' . $key);
109
+                        throw new Exception('Non-existent path item: '.$key);
110 110
                     }
111 111
                 } elseif ([] === $ref && false === $intKey && '-' !== $key) {
112 112
                     $ref = new \stdClass();
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
         if (array_key_exists($key, $a)) {
142 142
             return true;
143 143
         }
144
-        $key = (string)$key;
144
+        $key = (string) $key;
145 145
         foreach ($a as $k => $v) {
146
-            if ((string)$k === $key) {
146
+            if ((string) $k === $key) {
147 147
                 return true;
148 148
             }
149 149
         }
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 
153 153
     private static function arrayGet($key, array $a)
154 154
     {
155
-        $key = (string)$key;
155
+        $key = (string) $key;
156 156
         foreach ($a as $k => $v) {
157
-            if ((string)$k === $key) {
157
+            if ((string) $k === $key) {
158 158
                 return $v;
159 159
             }
160 160
         }
@@ -178,20 +178,20 @@  discard block
 block discarded – undo
178 178
                         Exception::EMPTY_PROPERTY_NAME_UNSUPPORTED);
179 179
                 }
180 180
 
181
-                $vars = (array)$ref;
181
+                $vars = (array) $ref;
182 182
                 if (self::arrayKeyExists($key, $vars)) {
183 183
                     $ref = self::arrayGet($key, $vars);
184 184
                 } else {
185
-                    throw new Exception('Key not found: ' . $key);
185
+                    throw new Exception('Key not found: '.$key);
186 186
                 }
187 187
             } elseif (is_array($ref)) {
188 188
                 if (self::arrayKeyExists($key, $ref)) {
189 189
                     $ref = $ref[$key];
190 190
                 } else {
191
-                    throw new Exception('Key not found: ' . $key);
191
+                    throw new Exception('Key not found: '.$key);
192 192
                 }
193 193
             } else {
194
-                throw new Exception('Key not found: ' . $key);
194
+                throw new Exception('Key not found: '.$key);
195 195
             }
196 196
         }
197 197
         return $ref;
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
                 if (property_exists($ref, $key)) {
225 225
                     $ref = &$ref->$key;
226 226
                 } else {
227
-                    throw new Exception('Key not found: ' . $key);
227
+                    throw new Exception('Key not found: '.$key);
228 228
                 }
229 229
             } else {
230 230
                 if (array_key_exists($key, $ref)) {
231 231
                     $ref = &$ref[$key];
232 232
                 } else {
233
-                    throw new Exception('Key not found: ' . $key);
233
+                    throw new Exception('Key not found: '.$key);
234 234
                 }
235 235
             }
236 236
         }
Please login to merge, or discard this patch.