Completed
Push — master ( 16f044...205892 )
by Viacheslav
10s
created
src/JsonPatch.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         foreach ($data as $operation) {
37 37
             /** @var OpPath|OpPathValue|OpPathFrom $operation */
38 38
             if (is_array($operation)) {
39
-                $operation = (object)$operation;
39
+                $operation = (object) $operation;
40 40
             }
41 41
 
42 42
             if (!isset($operation->op)) {
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
                     $op = new Test();
68 68
                     break;
69 69
                 default:
70
-                    throw new Exception('Unknown "op": ' . $operation->op);
70
+                    throw new Exception('Unknown "op": '.$operation->op);
71 71
             }
72 72
             $op->path = $operation->path;
73 73
             if ($op instanceof OpPathValue) {
74
-                if (!array_key_exists('value', (array)$operation)) {
74
+                if (!array_key_exists('value', (array) $operation)) {
75 75
                     throw new Exception('Missing "value" in operation data');
76 76
                 }
77 77
                 $op->value = $operation->value;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $result = array();
92 92
         foreach ($patch->operations as $operation) {
93
-            $result[] = (object)(array)$operation;
93
+            $result[] = (object) (array) $operation;
94 94
         }
95 95
 
96 96
         return $result;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
                     $diff = new JsonDiff($operation->value, $value,
144 144
                         JsonDiff::STOP_ON_DIFF);
145 145
                     if ($diff->getDiffCnt() !== 0) {
146
-                        throw new Exception('Test operation ' . json_encode($operation, JSON_UNESCAPED_SLASHES)
147
-                            . ' failed: ' . json_encode($value));
146
+                        throw new Exception('Test operation '.json_encode($operation, JSON_UNESCAPED_SLASHES)
147
+                            . ' failed: '.json_encode($value));
148 148
                     }
149 149
                     break;
150 150
             }
Please login to merge, or discard this patch.
src/JsonDiff.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
             $path = $this->path;
243 243
             $pathItems = $this->pathItems;
244
-            $this->path .= '/' . JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
244
+            $this->path .= '/'.JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
245 245
             $this->pathItems[] = $key;
246 246
 
247 247
             if (array_key_exists($key, $newArray)) {
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                 return null;
270 270
             }
271 271
             $newOrdered[$key] = $value;
272
-            $path = $this->path . '/' . JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
272
+            $path = $this->path.'/'.JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
273 273
             $pathItems = $this->pathItems;
274 274
             $pathItems[] = $key;
275 275
             JsonPointer::add($this->added, $pathItems, $value);
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
         }
281 281
 
282
-        return is_array($new) ? $newOrdered : (object)$newOrdered;
282
+        return is_array($new) ? $newOrdered : (object) $newOrdered;
283 283
     }
284 284
 
285 285
     private function rearrangeArray(array $original, array $new)
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
@@ -70,7 +70,9 @@
 block discarded – undo
70 70
                         throw new Exception('Non-existent path');
71 71
                     }
72 72
                 } else {
73
-                    if ($recursively && $ref === null) $ref = array();
73
+                    if ($recursively && $ref === null) {
74
+                        $ref = array();
75
+                    }
74 76
                     if ('-' === $key) {
75 77
                         $ref = &$ref[];
76 78
                     } else {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             }
37 37
         } else {
38 38
             if ($first !== '') {
39
-                throw new Exception('Path must start with "/": ' . $path);
39
+                throw new Exception('Path must start with "/": '.$path);
40 40
             }
41 41
             foreach ($pathItems as $key) {
42 42
                 $key = str_replace(array('~1', '~0'), array('/', '~'), $key);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             } else { // null or array
68 68
                 $intKey = filter_var($key, FILTER_VALIDATE_INT);
69 69
                 if ($ref === null && (false === $intKey || $intKey !== 0)) {
70
-                    $key = (string)$key;
70
+                    $key = (string) $key;
71 71
                     if ($recursively) {
72 72
                         $ref = new \stdClass();
73 73
                         $ref = &$ref->{$key};
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
         if (array_key_exists($key, $a)) {
105 105
             return true;
106 106
         }
107
-        $key = (string)$key;
107
+        $key = (string) $key;
108 108
         foreach ($a as $k => $v) {
109
-            if ((string)$k === $key) {
109
+            if ((string) $k === $key) {
110 110
                 return true;
111 111
             }
112 112
         }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 
116 116
     private static function arrayGet($key, array $a)
117 117
     {
118
-        $key = (string)$key;
118
+        $key = (string) $key;
119 119
         foreach ($a as $k => $v) {
120
-            if ((string)$k === $key) {
120
+            if ((string) $k === $key) {
121 121
                 return $v;
122 122
             }
123 123
         }
@@ -141,20 +141,20 @@  discard block
 block discarded – undo
141 141
                         Exception::EMPTY_PROPERTY_NAME_UNSUPPORTED);
142 142
                 }
143 143
 
144
-                $vars = (array)$ref;
144
+                $vars = (array) $ref;
145 145
                 if (self::arrayKeyExists($key, $vars)) {
146 146
                     $ref = self::arrayGet($key, $vars);
147 147
                 } else {
148
-                    throw new Exception('Key not found: ' . $key);
148
+                    throw new Exception('Key not found: '.$key);
149 149
                 }
150 150
             } elseif (is_array($ref)) {
151 151
                 if (self::arrayKeyExists($key, $ref)) {
152 152
                     $ref = $ref[$key];
153 153
                 } else {
154
-                    throw new Exception('Key not found: ' . $key);
154
+                    throw new Exception('Key not found: '.$key);
155 155
                 }
156 156
             } else {
157
-                throw new Exception('Key not found: ' . $key);
157
+                throw new Exception('Key not found: '.$key);
158 158
             }
159 159
         }
160 160
         return $ref;
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
                 if (property_exists($ref, $key)) {
177 177
                     $ref = &$ref->$key;
178 178
                 } else {
179
-                    throw new Exception('Key not found: ' . $key);
179
+                    throw new Exception('Key not found: '.$key);
180 180
                 }
181 181
             } else {
182 182
                 if (array_key_exists($key, $ref)) {
183 183
                     $ref = &$ref[$key];
184 184
                 } else {
185
-                    throw new Exception('Key not found: ' . $key);
185
+                    throw new Exception('Key not found: '.$key);
186 186
                 }
187 187
             }
188 188
         }
Please login to merge, or discard this patch.