Passed
Pull Request — master (#3)
by Viacheslav
01:56
created
src/Cli/Base.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,13 +54,13 @@
 block discarded – undo
54 54
     {
55 55
         $originalJson = file_get_contents($this->originalPath);
56 56
         if (!$originalJson) {
57
-            $this->response->error('Unable to read ' . $this->originalPath);
57
+            $this->response->error('Unable to read '.$this->originalPath);
58 58
             return;
59 59
         }
60 60
 
61 61
         $newJson = file_get_contents($this->newPath);
62 62
         if (!$newJson) {
63
-            $this->response->error('Unable to read ' . $this->newPath);
63
+            $this->response->error('Unable to read '.$this->newPath);
64 64
             return;
65 65
         }
66 66
 
Please login to merge, or discard this patch.
src/Cli/Apply.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@
 block discarded – undo
35 35
     {
36 36
         $patchJson = file_get_contents($this->patchPath);
37 37
         if (!$patchJson) {
38
-            $this->response->error('Unable to read ' . $this->patchPath);
38
+            $this->response->error('Unable to read '.$this->patchPath);
39 39
             return;
40 40
         }
41 41
 
42 42
         $baseJson = file_get_contents($this->basePath);
43 43
         if (!$baseJson) {
44
-            $this->response->error('Unable to read ' . $this->basePath);
44
+            $this->response->error('Unable to read '.$this->basePath);
45 45
             return;
46 46
         }
47 47
 
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
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         foreach ($originalKeys as $key => $originalValue) {
225 225
             $path = $this->path;
226 226
             $pathItems = $this->pathItems;
227
-            $this->path .= '/' . JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
227
+            $this->path .= '/'.JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
228 228
             $this->pathItems[] = $key;
229 229
 
230 230
             if (array_key_exists($key, $newArray)) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         // additions
249 249
         foreach ($newArray as $key => $value) {
250 250
             $newOrdered[$key] = $value;
251
-            $path = $this->path . '/' . JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
251
+            $path = $this->path.'/'.JsonPointer::escapeSegment($key, $this->options & self::JSON_URI_FRAGMENT_ID);
252 252
             $pathItems = $this->pathItems;
253 253
             $pathItems[] = $key;
254 254
             JsonPointer::add($this->added, $pathItems, $value);
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             }
263 263
         }
264 264
 
265
-        return is_array($new) ? $newOrdered : (object)$newOrdered;
265
+        return is_array($new) ? $newOrdered : (object) $newOrdered;
266 266
     }
267 267
 
268 268
     private function rearrangeArray(array $original, array $new)
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
@@ -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/JsonPointer.php 2 patches
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);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             if ($ref instanceof \stdClass) {
61 61
                 $ref = &$ref->$key;
62 62
             } elseif ($ref === null && false === filter_var($key, FILTER_VALIDATE_INT)) {
63
-                $key = (string)$key;
63
+                $key = (string) $key;
64 64
                 if ($recursively) {
65 65
                     $ref = new \stdClass();
66 66
                     $ref = &$ref->{$key};
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
         if (array_key_exists($key, $a)) {
88 88
             return true;
89 89
         }
90
-        $key = (string)$key;
90
+        $key = (string) $key;
91 91
         foreach ($a as $k => $v) {
92
-            if ((string)$k === $key) {
92
+            if ((string) $k === $key) {
93 93
                 return true;
94 94
             }
95 95
         }
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
     private static function arrayGet($key, array $a)
100 100
     {
101
-        $key = (string)$key;
101
+        $key = (string) $key;
102 102
         foreach ($a as $k => $v) {
103
-            if ((string)$k === $key) {
103
+            if ((string) $k === $key) {
104 104
                 return $v;
105 105
             }
106 106
         }
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
         $ref = $holder;
120 120
         while (null !== $key = array_shift($pathItems)) {
121 121
             if ($ref instanceof \stdClass) {
122
-                $vars = (array)$ref;
122
+                $vars = (array) $ref;
123 123
                 if (self::arrayKeyExists($key, $vars)) {
124 124
                     $ref = self::arrayGet($key, $vars);
125 125
                 } else {
126
-                    throw new Exception('Key not found: ' . $key);
126
+                    throw new Exception('Key not found: '.$key);
127 127
                 }
128 128
             } elseif (is_array($ref)) {
129 129
                 if (self::arrayKeyExists($key, $ref)) {
130 130
                     $ref = $ref[$key];
131 131
                 } else {
132
-                    throw new Exception('Key not found: ' . $key);
132
+                    throw new Exception('Key not found: '.$key);
133 133
                 }
134 134
             } else {
135
-                throw new Exception('Key not found: ' . $key);
135
+                throw new Exception('Key not found: '.$key);
136 136
             }
137 137
         }
138 138
         return $ref;
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
                 if (property_exists($ref, $key)) {
155 155
                     $ref = &$ref->$key;
156 156
                 } else {
157
-                    throw new Exception('Key not found: ' . $key);
157
+                    throw new Exception('Key not found: '.$key);
158 158
                 }
159 159
             } else {
160 160
                 if (array_key_exists($key, $ref)) {
161 161
                     $ref = &$ref[$key];
162 162
                 } else {
163
-                    throw new Exception('Key not found: ' . $key);
163
+                    throw new Exception('Key not found: '.$key);
164 164
                 }
165 165
             }
166 166
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@
 block discarded – undo
68 68
                     throw new Exception('Non-existent path');
69 69
                 }
70 70
             } else {
71
-                if ($recursively && $ref === null) $ref = array();
71
+                if ($recursively && $ref === null) {
72
+                    $ref = array();
73
+                }
72 74
                 if ('-' === $key) {
73 75
                     $ref = &$ref[];
74 76
                 } else {
Please login to merge, or discard this patch.