| @@ -243,11 +243,11 @@ discard block | ||
| 243 | 243 | |
| 244 | 244 |          if ($this->options & self::TOLERATE_ASSOCIATIVE_ARRAYS) { | 
| 245 | 245 |              if (is_array($original) && !empty($original) && !array_key_exists(0, $original)) { | 
| 246 | - $original = (object)$original; | |
| 246 | + $original = (object) $original; | |
| 247 | 247 | } | 
| 248 | 248 | |
| 249 | 249 |              if (is_array($new) && !empty($new) && !array_key_exists(0, $new)) { | 
| 250 | - $new = (object)$new; | |
| 250 | + $new = (object) $new; | |
| 251 | 251 | } | 
| 252 | 252 | } | 
| 253 | 253 | |
| @@ -294,12 +294,12 @@ discard block | ||
| 294 | 294 |          if ($merge && is_array($new) && !is_array($original)) { | 
| 295 | 295 | $merge = false; | 
| 296 | 296 | JsonPointer::add($this->merge, $this->pathItems, $new); | 
| 297 | -        } elseif ($merge  && $new instanceof \stdClass && !$original instanceof \stdClass) { | |
| 297 | +        } elseif ($merge && $new instanceof \stdClass && !$original instanceof \stdClass) { | |
| 298 | 298 | $merge = false; | 
| 299 | 299 | JsonPointer::add($this->merge, $this->pathItems, $new); | 
| 300 | 300 | } | 
| 301 | 301 | |
| 302 | - $isUriFragment = (bool)($this->options & self::JSON_URI_FRAGMENT_ID); | |
| 302 | + $isUriFragment = (bool) ($this->options & self::JSON_URI_FRAGMENT_ID); | |
| 303 | 303 |          foreach ($originalKeys as $key => $originalValue) { | 
| 304 | 304 |              if ($this->options & self::STOP_ON_DIFF) { | 
| 305 | 305 |                  if ($this->modifiedCnt || $this->addedCnt || $this->removedCnt) { | 
| @@ -313,7 +313,7 @@ discard block | ||
| 313 | 313 |              if ($isArray && is_int($actualKey)) { | 
| 314 | 314 | $actualKey -= $removedOffset; | 
| 315 | 315 | } | 
| 316 | - $this->path .= '/' . JsonPointer::escapeSegment((string)$actualKey, $isUriFragment); | |
| 316 | + $this->path .= '/'.JsonPointer::escapeSegment((string) $actualKey, $isUriFragment); | |
| 317 | 317 | $this->pathItems[] = $actualKey; | 
| 318 | 318 | |
| 319 | 319 |              if (array_key_exists($key, $newArray)) { | 
| @@ -350,7 +350,7 @@ discard block | ||
| 350 | 350 | return null; | 
| 351 | 351 | } | 
| 352 | 352 | $newOrdered[$key] = $value; | 
| 353 | - $path = $this->path . '/' . JsonPointer::escapeSegment($key, $isUriFragment); | |
| 353 | + $path = $this->path.'/'.JsonPointer::escapeSegment($key, $isUriFragment); | |
| 354 | 354 | $pathItems = $this->pathItems; | 
| 355 | 355 | $pathItems[] = $key; | 
| 356 | 356 | JsonPointer::add($this->added, $pathItems, $value); | 
| @@ -366,7 +366,7 @@ discard block | ||
| 366 | 366 | |
| 367 | 367 | } | 
| 368 | 368 | |
| 369 | - return is_array($new) ? $newOrdered : (object)$newOrdered; | |
| 369 | + return is_array($new) ? $newOrdered : (object) $newOrdered; | |
| 370 | 370 | } | 
| 371 | 371 | |
| 372 | 372 | private function rearrangeArray(array $original, array $new) | 
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 |      { | 
| 49 | 49 | $result = $isURIFragmentId ? '#' : ''; | 
| 50 | 50 |          foreach ($pathItems as $pathItem) { | 
| 51 | - $result .= '/' . self::escapeSegment($pathItem, $isURIFragmentId); | |
| 51 | + $result .= '/'.self::escapeSegment($pathItem, $isURIFragmentId); | |
| 52 | 52 | } | 
| 53 | 53 | return $result; | 
| 54 | 54 | } | 
| @@ -66,7 +66,7 @@ discard block | ||
| 66 | 66 | return self::splitPathURIFragment($pathItems); | 
| 67 | 67 |          } else { | 
| 68 | 68 |              if ($first !== '') { | 
| 69 | -                throw new Exception('Path must start with "/": ' . $path); | |
| 69 | +                throw new Exception('Path must start with "/": '.$path); | |
| 70 | 70 | } | 
| 71 | 71 | return self::splitPathJsonString($pathItems); | 
| 72 | 72 | } | 
| @@ -113,7 +113,7 @@ discard block | ||
| 113 | 113 | $ref = &$ref->$key; | 
| 114 | 114 |                  } else { | 
| 115 | 115 |                      if (!isset($ref->$key) && count($pathItems)) { | 
| 116 | -                        throw new Exception('Non-existent path item: ' . $key); | |
| 116 | +                        throw new Exception('Non-existent path item: '.$key); | |
| 117 | 117 |                      } else { | 
| 118 | 118 | $ref = &$ref->$key; | 
| 119 | 119 | } | 
| @@ -121,12 +121,12 @@ discard block | ||
| 121 | 121 |              } else { // null or array | 
| 122 | 122 | $intKey = filter_var($key, FILTER_VALIDATE_INT); | 
| 123 | 123 |                  if ($ref === null && (false === $intKey || $intKey !== 0)) { | 
| 124 | - $key = (string)$key; | |
| 124 | + $key = (string) $key; | |
| 125 | 125 |                      if ($flags & self::RECURSIVE_KEY_CREATION) { | 
| 126 | 126 | $ref = new \stdClass(); | 
| 127 | 127 |                          $ref = &$ref->{$key}; | 
| 128 | 128 |                      } else { | 
| 129 | -                        throw new Exception('Non-existent path item: ' . $key); | |
| 129 | +                        throw new Exception('Non-existent path item: '.$key); | |
| 130 | 130 | } | 
| 131 | 131 |                  } elseif ([] === $ref && 0 === ($flags & self::STRICT_MODE) && false === $intKey && '-' !== $key) { | 
| 132 | 132 | $ref = new \stdClass(); | 
| @@ -170,9 +170,9 @@ discard block | ||
| 170 | 170 |          if (array_key_exists($key, $a)) { | 
| 171 | 171 | return true; | 
| 172 | 172 | } | 
| 173 | - $key = (string)$key; | |
| 173 | + $key = (string) $key; | |
| 174 | 174 |          foreach ($a as $k => $v) { | 
| 175 | -            if ((string)$k === $key) { | |
| 175 | +            if ((string) $k === $key) { | |
| 176 | 176 | return true; | 
| 177 | 177 | } | 
| 178 | 178 | } | 
| @@ -181,9 +181,9 @@ discard block | ||
| 181 | 181 | |
| 182 | 182 | private static function arrayGet($key, array $a) | 
| 183 | 183 |      { | 
| 184 | - $key = (string)$key; | |
| 184 | + $key = (string) $key; | |
| 185 | 185 |          foreach ($a as $k => $v) { | 
| 186 | -            if ((string)$k === $key) { | |
| 186 | +            if ((string) $k === $key) { | |
| 187 | 187 | return $v; | 
| 188 | 188 | } | 
| 189 | 189 | } | 
| @@ -207,26 +207,26 @@ discard block | ||
| 207 | 207 | Exception::EMPTY_PROPERTY_NAME_UNSUPPORTED); | 
| 208 | 208 | } | 
| 209 | 209 | |
| 210 | - $vars = (array)$ref; | |
| 210 | + $vars = (array) $ref; | |
| 211 | 211 |                  if (self::arrayKeyExists($key, $vars)) { | 
| 212 | 212 | $ref = self::arrayGet($key, $vars); | 
| 213 | 213 |                  } else { | 
| 214 | -                    throw new Exception('Key not found: ' . $key); | |
| 214 | +                    throw new Exception('Key not found: '.$key); | |
| 215 | 215 | } | 
| 216 | 216 |              } elseif (is_array($ref)) { | 
| 217 | 217 |                  if (self::arrayKeyExists($key, $ref)) { | 
| 218 | 218 | $ref = $ref[$key]; | 
| 219 | 219 |                  } else { | 
| 220 | -                    throw new Exception('Key not found: ' . $key); | |
| 220 | +                    throw new Exception('Key not found: '.$key); | |
| 221 | 221 | } | 
| 222 | 222 |              } elseif (is_object($ref)) { | 
| 223 | 223 |                  if (isset($ref->$key)) { | 
| 224 | 224 | $ref = $ref->$key; | 
| 225 | 225 |                  } else { | 
| 226 | -                    throw new Exception('Key not found: ' . $key); | |
| 226 | +                    throw new Exception('Key not found: '.$key); | |
| 227 | 227 | } | 
| 228 | 228 |              } else { | 
| 229 | -                throw new Exception('Key not found: ' . $key); | |
| 229 | +                throw new Exception('Key not found: '.$key); | |
| 230 | 230 | } | 
| 231 | 231 | } | 
| 232 | 232 | return $ref; | 
| @@ -260,19 +260,19 @@ discard block | ||
| 260 | 260 |                  if (property_exists($ref, $key)) { | 
| 261 | 261 | $ref = &$ref->$key; | 
| 262 | 262 |                  } else { | 
| 263 | -                    throw new Exception('Key not found: ' . $key); | |
| 263 | +                    throw new Exception('Key not found: '.$key); | |
| 264 | 264 | } | 
| 265 | 265 |              } elseif (is_object($ref)) { | 
| 266 | 266 |                  if (isset($ref->$key)) { | 
| 267 | 267 | $ref = &$ref->$key; | 
| 268 | 268 |                  } else { | 
| 269 | -                    throw new Exception('Key not found: ' . $key); | |
| 269 | +                    throw new Exception('Key not found: '.$key); | |
| 270 | 270 | } | 
| 271 | 271 |              } else { | 
| 272 | 272 |                  if (array_key_exists($key, $ref)) { | 
| 273 | 273 | $ref = &$ref[$key]; | 
| 274 | 274 |                  } else { | 
| 275 | -                    throw new Exception('Key not found: ' . $key); | |
| 275 | +                    throw new Exception('Key not found: '.$key); | |
| 276 | 276 | } | 
| 277 | 277 | } | 
| 278 | 278 | } | 
| @@ -294,7 +294,7 @@ discard block | ||
| 294 | 294 | } | 
| 295 | 295 | |
| 296 | 296 | unset($parent[$refKey]); | 
| 297 | -                if (!$isAssociative && (int)$refKey !== count($parent)) { | |
| 297 | +                if (!$isAssociative && (int) $refKey !== count($parent)) { | |
| 298 | 298 | $parent = array_values($parent); | 
| 299 | 299 | } | 
| 300 | 300 | } |