@@ -127,6 +127,9 @@ discard block |
||
| 127 | 127 | return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | + /** |
|
| 131 | + * @param string $data |
|
| 132 | + */ |
|
| 130 | 133 | public function visitSimpleString($data, array $type, Context $context) |
| 131 | 134 | { |
| 132 | 135 | if (null === $this->document) { |
@@ -474,6 +477,9 @@ discard block |
||
| 474 | 477 | return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
| 475 | 478 | } |
| 476 | 479 | |
| 480 | + /** |
|
| 481 | + * @param string $value |
|
| 482 | + */ |
|
| 477 | 483 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
| 478 | 484 | { |
| 479 | 485 | if (null !== $namespace) { |
@@ -124,24 +124,24 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | if (null === $this->document) { |
| 126 | 126 | $this->document = $this->createDocument(null, null, true); |
| 127 | - $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data)); |
|
| 127 | + $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data)); |
|
| 128 | 128 | |
| 129 | 129 | return; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
|
| 132 | + return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | public function visitSimpleString($data, array $type, Context $context) |
| 136 | 136 | { |
| 137 | 137 | if (null === $this->document) { |
| 138 | 138 | $this->document = $this->createDocument(null, null, true); |
| 139 | - $this->currentNode->appendChild($this->document->createTextNode((string)$data)); |
|
| 139 | + $this->currentNode->appendChild($this->document->createTextNode((string) $data)); |
|
| 140 | 140 | |
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - return $this->document->createTextNode((string)$data); |
|
| 144 | + return $this->document->createTextNode((string) $data); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | public function visitBoolean($data, array $type, Context $context) |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $this->setCurrentNode($entryNode); |
| 190 | 190 | |
| 191 | 191 | if (null !== $keyAttributeName) { |
| 192 | - $entryNode->setAttribute($keyAttributeName, (string)$k); |
|
| 192 | + $entryNode->setAttribute($keyAttributeName, (string) $k); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (null !== $node = $this->navigator->accept($v, $this->getElementType($type), $context)) { |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $node = $this->navigator->accept($v, $metadata->type, $context); |
| 242 | 242 | $this->revertCurrentMetadata(); |
| 243 | 243 | |
| 244 | - if (!$node instanceof \DOMCharacterData) { |
|
| 244 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 245 | 245 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
| 246 | 246 | } |
| 247 | 247 | $attributeName = $this->namingStrategy->translateName($metadata); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
| 254 | - || (!$metadata->xmlValue && $this->hasValue) |
|
| 254 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
| 255 | 255 | ) { |
| 256 | 256 | throw new RuntimeException(sprintf('If you make use of @XmlValue, all other properties in the class must have the @XmlAttribute annotation. Invalid usage detected in class %s.', $metadata->class)); |
| 257 | 257 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $node = $this->navigator->accept($v, $metadata->type, $context); |
| 264 | 264 | $this->revertCurrentMetadata(); |
| 265 | 265 | |
| 266 | - if (!$node instanceof \DOMCharacterData) { |
|
| 266 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 267 | 267 | throw new RuntimeException(sprintf('Unsupported value for property %s::$%s. Expected character data, but got %s.', $metadata->reflection->class, $metadata->reflection->name, is_object($node) ? get_class($node) : gettype($node))); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | if ($metadata->xmlAttributeMap) { |
| 276 | - if (!is_array($v)) { |
|
| 276 | + if ( ! is_array($v)) { |
|
| 277 | 277 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', gettype($v))); |
| 278 | 278 | } |
| 279 | 279 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $node = $this->navigator->accept($value, null, $context); |
| 283 | 283 | $this->revertCurrentMetadata(); |
| 284 | 284 | |
| 285 | - if (!$node instanceof \DOMCharacterData) { |
|
| 285 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 286 | 286 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | return; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
| 295 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
| 296 | 296 | $elementName = $this->namingStrategy->translateName($metadata); |
| 297 | 297 | |
| 298 | 298 | $namespace = null !== $metadata->xmlNamespace |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | private function isSkippableEmptyObject($node, PropertyMetadata $metadata) |
| 337 | 337 | { |
| 338 | - return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 338 | + return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | private function isSkippableCollection(PropertyMetadata $metadata) |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | private function isElementEmpty(\DOMElement $element) |
| 347 | 347 | { |
| 348 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
| 348 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context) |
@@ -424,12 +424,12 @@ discard block |
||
| 424 | 424 | { |
| 425 | 425 | if (null === $this->document) { |
| 426 | 426 | $this->document = $this->createDocument(null, null, true); |
| 427 | - $this->currentNode->appendChild($textNode = $this->document->createTextNode((string)$data)); |
|
| 427 | + $this->currentNode->appendChild($textNode = $this->document->createTextNode((string) $data)); |
|
| 428 | 428 | |
| 429 | 429 | return $textNode; |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - return $this->document->createTextNode((string)$data); |
|
| 432 | + return $this->document->createTextNode((string) $data); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | private function attachNullNamespace() |
| 448 | 448 | { |
| 449 | - if (!$this->nullWasVisited) { |
|
| 449 | + if ( ! $this->nullWasVisited) { |
|
| 450 | 450 | $this->document->documentElement->setAttributeNS( |
| 451 | 451 | 'http://www.w3.org/2000/xmlns/', |
| 452 | 452 | 'xmlns:xsi', |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
| 468 | 468 | $attribute = 'xmlns'; |
| 469 | 469 | if ($prefix !== '') { |
| 470 | - $attribute .= ':' . $prefix; |
|
| 470 | + $attribute .= ':'.$prefix; |
|
| 471 | 471 | } elseif ($element->namespaceURI === $uri) { |
| 472 | 472 | continue; |
| 473 | 473 | } |
@@ -483,19 +483,19 @@ discard block |
||
| 483 | 483 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
| 484 | 484 | return $this->document->createElementNS($namespace, $tagName); |
| 485 | 485 | } |
| 486 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 487 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 486 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 487 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 488 | 488 | } |
| 489 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
| 489 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
| 493 | 493 | { |
| 494 | 494 | if (null !== $namespace) { |
| 495 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
| 496 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 495 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
| 496 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 497 | 497 | } |
| 498 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
| 498 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
| 499 | 499 | } else { |
| 500 | 500 | $node->setAttribute($name, $value); |
| 501 | 501 | } |
@@ -519,6 +519,6 @@ discard block |
||
| 519 | 519 | */ |
| 520 | 520 | public function setFormatOutput($formatOutput) |
| 521 | 521 | { |
| 522 | - $this->formatOutput = (boolean)$formatOutput; |
|
| 522 | + $this->formatOutput = (boolean) $formatOutput; |
|
| 523 | 523 | } |
| 524 | 524 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $isHash = isset($type['params'][1]); |
| 85 | 85 | |
| 86 | 86 | $count = $this->writer->changeCount; |
| 87 | - $isList = (isset($type['params'][0]) && !isset($type['params'][1])) |
|
| 87 | + $isList = (isset($type['params'][0]) && ! isset($type['params'][1])) |
|
| 88 | 88 | || array_keys($data) === range(0, count($data) - 1); |
| 89 | 89 | |
| 90 | 90 | foreach ($data as $k => $v) { |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | continue; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if ($isList && !$isHash) { |
|
| 95 | + if ($isList && ! $isHash) { |
|
| 96 | 96 | $this->writer->writeln('-'); |
| 97 | 97 | } else { |
| 98 | - $this->writer->writeln(Inline::dump($k) . ':'); |
|
| 98 | + $this->writer->writeln(Inline::dump($k).':'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $this->writer->indent(); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if (null !== $v = $this->navigator->accept($v, $this->getElementType($type), $context)) { |
| 104 | 104 | $this->writer |
| 105 | 105 | ->rtrim(false) |
| 106 | - ->writeln(' ' . $v); |
|
| 106 | + ->writeln(' '.$v); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | $this->writer->outdent(); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | public function visitDouble($data, array $type, Context $context) |
| 135 | 135 | { |
| 136 | - $v = (string)$data; |
|
| 136 | + $v = (string) $data; |
|
| 137 | 137 | |
| 138 | 138 | if ('' === $this->writer->content) { |
| 139 | 139 | $this->writer->writeln($v); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | public function visitInteger($data, array $type, Context $context) |
| 146 | 146 | { |
| 147 | - $v = (string)$data; |
|
| 147 | + $v = (string) $data; |
|
| 148 | 148 | |
| 149 | 149 | if ('' === $this->writer->content) { |
| 150 | 150 | $this->writer->writeln($v); |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $name = $this->namingStrategy->translateName($metadata); |
| 169 | 169 | |
| 170 | - if (!$metadata->inline) { |
|
| 170 | + if ( ! $metadata->inline) { |
|
| 171 | 171 | $this->writer |
| 172 | - ->writeln(Inline::dump($name) . ':') |
|
| 172 | + ->writeln(Inline::dump($name).':') |
|
| 173 | 173 | ->indent(); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | if (null !== $v = $this->navigator->accept($v, $metadata->type, $context)) { |
| 181 | 181 | $this->writer |
| 182 | 182 | ->rtrim(false) |
| 183 | - ->writeln(' ' . $v); |
|
| 184 | - } elseif ($count === $this->writer->changeCount && !$metadata->inline) { |
|
| 183 | + ->writeln(' '.$v); |
|
| 184 | + } elseif ($count === $this->writer->changeCount && ! $metadata->inline) { |
|
| 185 | 185 | $this->writer->revert(); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if (!$metadata->inline) { |
|
| 188 | + if ( ! $metadata->inline) { |
|
| 189 | 189 | $this->writer->outdent(); |
| 190 | 190 | } |
| 191 | 191 | $this->revertCurrentMetadata(); |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | return $this->initializedHandlers[$direction][$typeName][$format]; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
| 46 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
| 47 | 47 | return null; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | switch ($direction) { |
| 36 | 36 | case GraphNavigator::DIRECTION_DESERIALIZATION: |
| 37 | - return 'deserialize' . $type . 'From' . $format; |
|
| 37 | + return 'deserialize'.$type.'From'.$format; |
|
| 38 | 38 | |
| 39 | 39 | case GraphNavigator::DIRECTION_SERIALIZATION: |
| 40 | - return 'serialize' . $type . 'To' . $format; |
|
| 40 | + return 'serialize'.$type.'To'.$format; |
|
| 41 | 41 | |
| 42 | 42 | default: |
| 43 | 43 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigator::DIRECTION_??? constants.', json_encode($direction))); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler) |
| 53 | 53 | { |
| 54 | 54 | foreach ($handler->getSubscribingMethods() as $methodData) { |
| 55 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
| 55 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
| 56 | 56 | throw new RuntimeException(sprintf('For each subscribing method a "type" and "format" attribute must be given, but only got "%s" for %s.', implode('" and "', array_keys($methodData)), get_class($handler))); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function getHandler($direction, $typeName, $format) |
| 81 | 81 | { |
| 82 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
| 82 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
| 83 | 83 | return null; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -41,14 +41,14 @@ |
||
| 41 | 41 | 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
| 42 | 42 | 'type' => $type, |
| 43 | 43 | 'format' => $format, |
| 44 | - 'method' => 'serialize' . $shortName, |
|
| 44 | + 'method' => 'serialize'.$shortName, |
|
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | 47 | $methods[] = array( |
| 48 | 48 | 'direction' => GraphNavigator::DIRECTION_DESERIALIZATION, |
| 49 | 49 | 'type' => $type, |
| 50 | 50 | 'format' => $format, |
| 51 | - 'method' => 'deserialize' . $shortName, |
|
| 51 | + 'method' => 'deserialize'.$shortName, |
|
| 52 | 52 | ); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
| 41 | 41 | 'type' => $type, |
| 42 | 42 | 'format' => $format, |
| 43 | - 'method' => $method . 'To' . $format, |
|
| 43 | + 'method' => $method.'To'.$format, |
|
| 44 | 44 | ); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function startVisiting($object) |
| 51 | 51 | { |
| 52 | - if (!is_object($object)) { |
|
| 52 | + if ( ! is_object($object)) { |
|
| 53 | 53 | return; |
| 54 | 54 | } |
| 55 | 55 | $this->visitingSet->attach($object); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function stopVisiting($object) |
| 60 | 60 | { |
| 61 | - if (!is_object($object)) { |
|
| 61 | + if ( ! is_object($object)) { |
|
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | 64 | $this->visitingSet->detach($object); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function isVisiting($object) |
| 73 | 73 | { |
| 74 | - if (!is_object($object)) { |
|
| 74 | + if ( ! is_object($object)) { |
|
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $path[] = get_class($obj); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if (!$path) { |
|
| 88 | + if ( ! $path) { |
|
| 89 | 89 | return null; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function getObject() |
| 106 | 106 | { |
| 107 | - return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
| 107 | + return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | public function getVisitingStack() |
@@ -59,22 +59,22 @@ |
||
| 59 | 59 | $class = $this->reflection->getDeclaringClass(); |
| 60 | 60 | |
| 61 | 61 | if (empty($getter)) { |
| 62 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
| 63 | - $getter = 'get' . $this->name; |
|
| 64 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
| 65 | - $getter = 'is' . $this->name; |
|
| 66 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
| 67 | - $getter = 'has' . $this->name; |
|
| 62 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
| 63 | + $getter = 'get'.$this->name; |
|
| 64 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
| 65 | + $getter = 'is'.$this->name; |
|
| 66 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
| 67 | + $getter = 'has'.$this->name; |
|
| 68 | 68 | } else { |
| 69 | - throw new RuntimeException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get' . ucfirst($this->name), 'is' . ucfirst($this->name), 'has' . ucfirst($this->name), $this->class, $this->name)); |
|
| 69 | + throw new RuntimeException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get'.ucfirst($this->name), 'is'.ucfirst($this->name), 'has'.ucfirst($this->name), $this->class, $this->name)); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if (empty($setter) && !$this->readOnly) { |
|
| 74 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
| 75 | - $setter = 'set' . $this->name; |
|
| 73 | + if (empty($setter) && ! $this->readOnly) { |
|
| 74 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
| 75 | + $setter = 'set'.$this->name; |
|
| 76 | 76 | } else { |
| 77 | - throw new RuntimeException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set' . ucfirst($this->name), $this->class, $this->name)); |
|
| 77 | + throw new RuntimeException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set'.ucfirst($this->name), $this->class, $this->name)); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function setAccessorOrder($order, array $customOrder = array()) |
| 90 | 90 | { |
| 91 | - if (!in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) { |
|
| 91 | + if ( ! in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) { |
|
| 92 | 92 | throw new InvalidArgumentException(sprintf('The accessor order "%s" is invalid.', $order)); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | foreach ($customOrder as $name) { |
| 96 | - if (!is_string($name)) { |
|
| 96 | + if ( ! is_string($name)) { |
|
| 97 | 97 | throw new InvalidArgumentException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name))); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | public function merge(MergeableInterface $object) |
| 131 | 131 | { |
| 132 | - if (!$object instanceof ClassMetadata) { |
|
| 132 | + if ( ! $object instanceof ClassMetadata) { |
|
| 133 | 133 | throw new InvalidArgumentException('$object must be an instance of ClassMetadata.'); |
| 134 | 134 | } |
| 135 | 135 | parent::merge($object); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $this->discriminatorBaseClass, |
| 154 | 154 | $this->discriminatorBaseClass |
| 155 | 155 | )); |
| 156 | - } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 156 | + } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 157 | 157 | $this->discriminatorFieldName = $object->discriminatorFieldName; |
| 158 | 158 | $this->discriminatorMap = $object->discriminatorMap; |
| 159 | 159 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $this->discriminatorBaseClass = $object->discriminatorBaseClass; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if ($this->discriminatorMap && !$this->reflection->isAbstract()) { |
|
| 171 | + if ($this->discriminatorMap && ! $this->reflection->isAbstract()) { |
|
| 172 | 172 | if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) { |
| 173 | 173 | throw new \LogicException(sprintf( |
| 174 | 174 | 'The sub-class "%s" is not listed in the discriminator of the base class "%s".', |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $this->discriminatorValue = $typeValue; |
| 181 | 181 | |
| 182 | 182 | if (isset($this->propertyMetadata[$this->discriminatorFieldName]) |
| 183 | - && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 183 | + && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 184 | 184 | ) { |
| 185 | 185 | throw new \LogicException(sprintf( |
| 186 | 186 | 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | public function registerNamespace($uri, $prefix = null) |
| 209 | 209 | { |
| 210 | - if (!is_string($uri)) { |
|
| 210 | + if ( ! is_string($uri)) { |
|
| 211 | 211 | throw new InvalidArgumentException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri))); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | if ($prefix !== null) { |
| 215 | - if (!is_string($prefix)) { |
|
| 215 | + if ( ! is_string($prefix)) { |
|
| 216 | 216 | throw new InvalidArgumentException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix))); |
| 217 | 217 | } |
| 218 | 218 | } else { |
@@ -300,19 +300,19 @@ discard block |
||
| 300 | 300 | case self::ACCESSOR_ORDER_CUSTOM: |
| 301 | 301 | $order = $this->customOrder; |
| 302 | 302 | $currentSorting = $this->propertyMetadata ? array_combine(array_keys($this->propertyMetadata), range(1, count($this->propertyMetadata))) : []; |
| 303 | - uksort($this->propertyMetadata, function ($a, $b) use ($order, $currentSorting) { |
|
| 303 | + uksort($this->propertyMetadata, function($a, $b) use ($order, $currentSorting) { |
|
| 304 | 304 | $existsA = isset($order[$a]); |
| 305 | 305 | $existsB = isset($order[$b]); |
| 306 | 306 | |
| 307 | - if (!$existsA && !$existsB) { |
|
| 307 | + if ( ! $existsA && ! $existsB) { |
|
| 308 | 308 | return $currentSorting[$a] - $currentSorting[$b]; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if (!$existsA) { |
|
| 311 | + if ( ! $existsA) { |
|
| 312 | 312 | return 1; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - if (!$existsB) { |
|
| 315 | + if ( ! $existsB) { |
|
| 316 | 316 | return -1; |
| 317 | 317 | } |
| 318 | 318 | |