Completed
Pull Request — master (#3)
by Viacheslav
01:57
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/JsonPointer.php 1 patch
Spacing   +13 added lines, -13 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);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 && !is_int($key)
65 65
                 && false === filter_var($key, FILTER_VALIDATE_INT)
66 66
             ) {
67
-                $key = (string)$key;
67
+                $key = (string) $key;
68 68
                 if ($recursively) {
69 69
                     $ref = new \stdClass();
70 70
                     $ref = &$ref->{$key};
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 if ('-' === $key) {
80 80
                     $ref = &$ref[];
81 81
                 } else {
82
-                    $key = (int)$key;
82
+                    $key = (int) $key;
83 83
                     if (is_array($ref) && array_key_exists($key, $ref) && !$pathItems) {
84 84
                         array_splice($ref, $key, 0, array($value));
85 85
                     }
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
         if (array_key_exists($key, $a)) {
96 96
             return true;
97 97
         }
98
-        $key = (string)$key;
98
+        $key = (string) $key;
99 99
         foreach ($a as $k => $v) {
100
-            if ((string)$k === $key) {
100
+            if ((string) $k === $key) {
101 101
                 return true;
102 102
             }
103 103
         }
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
     private static function arrayGet($key, array $a)
108 108
     {
109
-        $key = (string)$key;
109
+        $key = (string) $key;
110 110
         foreach ($a as $k => $v) {
111
-            if ((string)$k === $key) {
111
+            if ((string) $k === $key) {
112 112
                 return $v;
113 113
             }
114 114
         }
@@ -127,20 +127,20 @@  discard block
 block discarded – undo
127 127
         $ref = $holder;
128 128
         while (null !== $key = array_shift($pathItems)) {
129 129
             if ($ref instanceof \stdClass) {
130
-                $vars = (array)$ref;
130
+                $vars = (array) $ref;
131 131
                 if (self::arrayKeyExists($key, $vars)) {
132 132
                     $ref = self::arrayGet($key, $vars);
133 133
                 } else {
134
-                    throw new Exception('Key not found: ' . $key);
134
+                    throw new Exception('Key not found: '.$key);
135 135
                 }
136 136
             } elseif (is_array($ref)) {
137 137
                 if (self::arrayKeyExists($key, $ref)) {
138 138
                     $ref = $ref[$key];
139 139
                 } else {
140
-                    throw new Exception('Key not found: ' . $key);
140
+                    throw new Exception('Key not found: '.$key);
141 141
                 }
142 142
             } else {
143
-                throw new Exception('Key not found: ' . $key);
143
+                throw new Exception('Key not found: '.$key);
144 144
             }
145 145
         }
146 146
         return $ref;
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
                 if (property_exists($ref, $key)) {
163 163
                     $ref = &$ref->$key;
164 164
                 } else {
165
-                    throw new Exception('Key not found: ' . $key);
165
+                    throw new Exception('Key not found: '.$key);
166 166
                 }
167 167
             } else {
168 168
                 if (array_key_exists($key, $ref)) {
169 169
                     $ref = &$ref[$key];
170 170
                 } else {
171
-                    throw new Exception('Key not found: ' . $key);
171
+                    throw new Exception('Key not found: '.$key);
172 172
                 }
173 173
             }
174 174
         }
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.