@@ -35,13 +35,13 @@ |
||
| 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 | |
@@ -224,7 +224,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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) |
@@ -36,7 +36,7 @@ discard block |
||
| 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('~0', '~1'), array('~', '/'), $key); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | && !is_int($key) |
| 62 | 62 | && false === filter_var($key, FILTER_VALIDATE_INT) |
| 63 | 63 | ) { |
| 64 | - $key = (string)$key; |
|
| 64 | + $key = (string) $key; |
|
| 65 | 65 | $ref = new \stdClass(); |
| 66 | 66 | $ref = &$ref->{$key}; |
| 67 | 67 | } else { |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | if (array_key_exists($key, $a)) { |
| 77 | 77 | return true; |
| 78 | 78 | } |
| 79 | - $key = (string)$key; |
|
| 79 | + $key = (string) $key; |
|
| 80 | 80 | foreach ($a as $k => $v) { |
| 81 | - if ((string)$k === $key) { |
|
| 81 | + if ((string) $k === $key) { |
|
| 82 | 82 | return true; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | private static function arrayGet($key, array $a) |
| 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 $v; |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -108,20 +108,20 @@ discard block |
||
| 108 | 108 | $ref = $holder; |
| 109 | 109 | while (null !== $key = array_shift($pathItems)) { |
| 110 | 110 | if ($ref instanceof \stdClass) { |
| 111 | - $vars = (array)$ref; |
|
| 111 | + $vars = (array) $ref; |
|
| 112 | 112 | if (self::arrayKeyExists($key, $vars)) { |
| 113 | 113 | $ref = self::arrayGet($key, $vars); |
| 114 | 114 | } else { |
| 115 | - throw new Exception('Key not found: ' . $key); |
|
| 115 | + throw new Exception('Key not found: '.$key); |
|
| 116 | 116 | } |
| 117 | 117 | } elseif (is_array($ref)) { |
| 118 | 118 | if (self::arrayKeyExists($key, $ref)) { |
| 119 | 119 | $ref = $ref[$key]; |
| 120 | 120 | } else { |
| 121 | - throw new Exception('Key not found: ' . $key); |
|
| 121 | + throw new Exception('Key not found: '.$key); |
|
| 122 | 122 | } |
| 123 | 123 | } else { |
| 124 | - throw new Exception('Key not found: ' . $key); |
|
| 124 | + throw new Exception('Key not found: '.$key); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | return $ref; |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | if (property_exists($ref, $key)) { |
| 144 | 144 | $ref = &$ref->$key; |
| 145 | 145 | } else { |
| 146 | - throw new Exception('Key not found: ' . $key); |
|
| 146 | + throw new Exception('Key not found: '.$key); |
|
| 147 | 147 | } |
| 148 | 148 | } else { |
| 149 | 149 | if (array_key_exists($key, $ref)) { |
| 150 | 150 | $ref = &$ref[$key]; |
| 151 | 151 | } else { |
| 152 | - throw new Exception('Key not found: ' . $key); |
|
| 152 | + throw new Exception('Key not found: '.$key); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $diff = new JsonDiff($operation->value, $value, |
| 143 | 143 | JsonDiff::STOP_ON_DIFF); |
| 144 | 144 | if ($diff->getDiffCnt() !== 0) { |
| 145 | - throw new Exception('Test operation ' . json_encode($operation) . ' failed: ' . json_encode($value)); |
|
| 145 | + throw new Exception('Test operation '.json_encode($operation).' failed: '.json_encode($value)); |
|
| 146 | 146 | } |
| 147 | 147 | break; |
| 148 | 148 | } |