@@ -346,7 +346,6 @@ |
||
| 346 | 346 | /** |
| 347 | 347 | * Retrieves internalSubset even in bugfixed php versions |
| 348 | 348 | * |
| 349 | - * @param \DOMDocumentType $child |
|
| 350 | 349 | * @param string $data |
| 351 | 350 | * @return string |
| 352 | 351 | */ |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | if (false !== stripos($data, '<!doctype')) { |
| 70 | 70 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
| 71 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
| 71 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
| 72 | 72 | throw new InvalidArgumentException(sprintf( |
| 73 | 73 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
| 74 | 74 | $internalSubset |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | private function emptyStringToSpaceCharacter($data) |
| 92 | 92 | { |
| 93 | - return $data === '' ? ' ' : (string)$data; |
|
| 93 | + return $data === '' ? ' ' : (string) $data; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function visitNull($data, array $type, Context $context) |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | public function visitString($data, array $type, Context $context) |
| 102 | 102 | { |
| 103 | - $data = (string)$data; |
|
| 103 | + $data = (string) $data; |
|
| 104 | 104 | |
| 105 | 105 | if (null === $this->result) { |
| 106 | 106 | $this->result = $data; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | public function visitBoolean($data, array $type, Context $context) |
| 113 | 113 | { |
| 114 | - $data = (string)$data; |
|
| 114 | + $data = (string) $data; |
|
| 115 | 115 | |
| 116 | 116 | if ('true' === $data || '1' === $data) { |
| 117 | 117 | $data = true; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | public function visitInteger($data, array $type, Context $context) |
| 132 | 132 | { |
| 133 | - $data = (integer)$data; |
|
| 133 | + $data = (integer) $data; |
|
| 134 | 134 | |
| 135 | 135 | if (null === $this->result) { |
| 136 | 136 | $this->result = $data; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | public function visitDouble($data, array $type, Context $context) |
| 143 | 143 | { |
| 144 | - $data = (double)$data; |
|
| 144 | + $data = (double) $data; |
|
| 145 | 145 | |
| 146 | 146 | if (null === $this->result) { |
| 147 | 147 | $this->result = $data; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $nodes = $data->xpath($entryName); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if (!\count($nodes)) { |
|
| 195 | + if ( ! \count($nodes)) { |
|
| 196 | 196 | if (null === $this->result) { |
| 197 | 197 | return $this->result = array(); |
| 198 | 198 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $nodes = $data->children($namespace)->$entryName; |
| 232 | 232 | foreach ($nodes as $v) { |
| 233 | 233 | $attrs = $v->attributes(); |
| 234 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
| 234 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
| 235 | 235 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
| 236 | 236 | } |
| 237 | 237 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $name = $this->namingStrategy->translateName($metadata); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - if (!$metadata->type) { |
|
| 266 | + if ( ! $metadata->type) { |
|
| 267 | 267 | throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name)); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | if ($metadata->xmlCollection) { |
| 289 | 289 | $enclosingElem = $data; |
| 290 | - if (!$metadata->xmlCollectionInline) { |
|
| 290 | + if ( ! $metadata->xmlCollectionInline) { |
|
| 291 | 291 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | if ($metadata->xmlNamespace) { |
| 303 | 303 | $node = $data->children($metadata->xmlNamespace)->$name; |
| 304 | - if (!$node->count()) { |
|
| 304 | + if ( ! $node->count()) { |
|
| 305 | 305 | return; |
| 306 | 306 | } |
| 307 | 307 | } else { |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | if (isset($namespaces[''])) { |
| 312 | 312 | $prefix = uniqid('ns-'); |
| 313 | 313 | $data->registerXPathNamespace($prefix, $namespaces['']); |
| 314 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
| 314 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
| 315 | 315 | } else { |
| 316 | - $nodes = $data->xpath('./' . $name); |
|
| 316 | + $nodes = $data->xpath('./'.$name); |
|
| 317 | 317 | } |
| 318 | 318 | if (empty($nodes)) { |
| 319 | 319 | return; |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | ? null |
| 57 | 57 | : $context->attributes->get('validation_groups')->get(); |
| 58 | 58 | |
| 59 | - if (!$groups) { |
|
| 59 | + if ( ! $groups) { |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | foreach ($data as $key => $value) { |
| 41 | - if (!property_exists(__CLASS__, $key)) { |
|
| 41 | + if ( ! property_exists(__CLASS__, $key)) { |
|
| 42 | 42 | throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, __CLASS__)); |
| 43 | 43 | } |
| 44 | 44 | $this->{$key} = $value; |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $classMetadata = $context->getMetadataFactory()->getMetadataForClass('stdClass'); |
| 51 | 51 | $visitor->startVisitingObject($classMetadata, $stdClass, array('name' => 'stdClass'), $context); |
| 52 | 52 | |
| 53 | - foreach ((array)$stdClass as $name => $value) { |
|
| 53 | + foreach ((array) $stdClass as $name => $value) { |
|
| 54 | 54 | $metadata = new StaticPropertyMetadata('stdClass', $name, $value); |
| 55 | 55 | $visitor->visitProperty($metadata, $value, $context); |
| 56 | 56 | } |
@@ -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) { |
@@ -125,24 +125,24 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | if (null === $this->document) { |
| 127 | 127 | $this->document = $this->createDocument(null, null, true); |
| 128 | - $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data)); |
|
| 128 | + $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data)); |
|
| 129 | 129 | |
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
|
| 133 | + return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | public function visitSimpleString($data, array $type, Context $context) |
| 137 | 137 | { |
| 138 | 138 | if (null === $this->document) { |
| 139 | 139 | $this->document = $this->createDocument(null, null, true); |
| 140 | - $this->currentNode->appendChild($this->document->createTextNode((string)$data)); |
|
| 140 | + $this->currentNode->appendChild($this->document->createTextNode((string) $data)); |
|
| 141 | 141 | |
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - return $this->document->createTextNode((string)$data); |
|
| 145 | + return $this->document->createTextNode((string) $data); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | public function visitBoolean($data, array $type, Context $context) |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $this->setCurrentNode($entryNode); |
| 191 | 191 | |
| 192 | 192 | if (null !== $keyAttributeName) { |
| 193 | - $entryNode->setAttribute($keyAttributeName, (string)$k); |
|
| 193 | + $entryNode->setAttribute($keyAttributeName, (string) $k); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if (null !== $node = $this->navigator->accept($v, $this->getElementType($type), $context)) { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $node = $this->navigator->accept($v, $metadata->type, $context); |
| 243 | 243 | $this->revertCurrentMetadata(); |
| 244 | 244 | |
| 245 | - if (!$node instanceof \DOMCharacterData) { |
|
| 245 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 246 | 246 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
| 247 | 247 | } |
| 248 | 248 | if ($this->namingStrategy instanceof AdvancedNamingStrategyInterface) { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
| 259 | - || (!$metadata->xmlValue && $this->hasValue) |
|
| 259 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
| 260 | 260 | ) { |
| 261 | 261 | 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)); |
| 262 | 262 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $node = $this->navigator->accept($v, $metadata->type, $context); |
| 269 | 269 | $this->revertCurrentMetadata(); |
| 270 | 270 | |
| 271 | - if (!$node instanceof \DOMCharacterData) { |
|
| 271 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 272 | 272 | 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))); |
| 273 | 273 | } |
| 274 | 274 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | if ($metadata->xmlAttributeMap) { |
| 281 | - if (!\is_array($v)) { |
|
| 281 | + if ( ! \is_array($v)) { |
|
| 282 | 282 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v))); |
| 283 | 283 | } |
| 284 | 284 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $node = $this->navigator->accept($value, null, $context); |
| 288 | 288 | $this->revertCurrentMetadata(); |
| 289 | 289 | |
| 290 | - if (!$node instanceof \DOMCharacterData) { |
|
| 290 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 291 | 291 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
| 292 | 292 | } |
| 293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | return; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
| 300 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
| 301 | 301 | if ($this->namingStrategy instanceof AdvancedNamingStrategyInterface) { |
| 302 | 302 | $elementName = $this->namingStrategy->getPropertyName($metadata, $context); |
| 303 | 303 | } else { |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | private function isSkippableEmptyObject($node, PropertyMetadata $metadata) |
| 346 | 346 | { |
| 347 | - return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 347 | + return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | private function isSkippableCollection(PropertyMetadata $metadata) |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | |
| 355 | 355 | private function isElementEmpty(\DOMElement $element) |
| 356 | 356 | { |
| 357 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
| 357 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context) |
@@ -433,12 +433,12 @@ discard block |
||
| 433 | 433 | { |
| 434 | 434 | if (null === $this->document) { |
| 435 | 435 | $this->document = $this->createDocument(null, null, true); |
| 436 | - $this->currentNode->appendChild($textNode = $this->document->createTextNode((string)$data)); |
|
| 436 | + $this->currentNode->appendChild($textNode = $this->document->createTextNode((string) $data)); |
|
| 437 | 437 | |
| 438 | 438 | return $textNode; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - return $this->document->createTextNode((string)$data); |
|
| 441 | + return $this->document->createTextNode((string) $data); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | /** |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | private function attachNullNamespace() |
| 457 | 457 | { |
| 458 | - if (!$this->nullWasVisited) { |
|
| 458 | + if ( ! $this->nullWasVisited) { |
|
| 459 | 459 | $this->document->documentElement->setAttributeNS( |
| 460 | 460 | 'http://www.w3.org/2000/xmlns/', |
| 461 | 461 | 'xmlns:xsi', |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
| 477 | 477 | $attribute = 'xmlns'; |
| 478 | 478 | if ($prefix !== '') { |
| 479 | - $attribute .= ':' . $prefix; |
|
| 479 | + $attribute .= ':'.$prefix; |
|
| 480 | 480 | } elseif ($element->namespaceURI === $uri) { |
| 481 | 481 | continue; |
| 482 | 482 | } |
@@ -492,19 +492,19 @@ discard block |
||
| 492 | 492 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
| 493 | 493 | return $this->document->createElementNS($namespace, $tagName); |
| 494 | 494 | } |
| 495 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 496 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 495 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 496 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 497 | 497 | } |
| 498 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
| 498 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
| 502 | 502 | { |
| 503 | 503 | if (null !== $namespace) { |
| 504 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
| 505 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 504 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
| 505 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 506 | 506 | } |
| 507 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
| 507 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
| 508 | 508 | } else { |
| 509 | 509 | $node->setAttribute($name, $value); |
| 510 | 510 | } |
@@ -528,6 +528,6 @@ discard block |
||
| 528 | 528 | */ |
| 529 | 529 | public function setFormatOutput($formatOutput) |
| 530 | 530 | { |
| 531 | - $this->formatOutput = (boolean)$formatOutput; |
|
| 531 | + $this->formatOutput = (boolean) $formatOutput; |
|
| 532 | 532 | } |
| 533 | 533 | } |
@@ -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 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'type' => $type, |
| 54 | 54 | 'format' => $format, |
| 55 | 55 | 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
| 56 | - 'method' => 'serialize' . $type, |
|
| 56 | + 'method' => 'serialize'.$type, |
|
| 57 | 57 | ); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | private function isDataXmlNull($data) |
| 117 | 117 | { |
| 118 | 118 | $attributes = $data->attributes('xsi', true); |
| 119 | - return isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true'; |
|
| 119 | + return isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function deserializeDateTimeFromXml(XmlDeserializationVisitor $visitor, $data, array $type) |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | private function parseDateTime($data, array $type, $immutable = false) |
| 177 | 177 | { |
| 178 | - $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 178 | + $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 179 | 179 | $format = $this->getDeserializationFormat($type); |
| 180 | 180 | |
| 181 | 181 | if ($immutable) { |
| 182 | - $datetime = \DateTimeImmutable::createFromFormat($format, (string)$data, $timezone); |
|
| 182 | + $datetime = \DateTimeImmutable::createFromFormat($format, (string) $data, $timezone); |
|
| 183 | 183 | } else { |
| 184 | - $datetime = \DateTime::createFromFormat($format, (string)$data, $timezone); |
|
| 184 | + $datetime = \DateTime::createFromFormat($format, (string) $data, $timezone); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (false === $datetime) { |
@@ -236,15 +236,15 @@ discard block |
||
| 236 | 236 | $format = 'P'; |
| 237 | 237 | |
| 238 | 238 | if (0 < $dateInterval->y) { |
| 239 | - $format .= $dateInterval->y . 'Y'; |
|
| 239 | + $format .= $dateInterval->y.'Y'; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | if (0 < $dateInterval->m) { |
| 243 | - $format .= $dateInterval->m . 'M'; |
|
| 243 | + $format .= $dateInterval->m.'M'; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | if (0 < $dateInterval->d) { |
| 247 | - $format .= $dateInterval->d . 'D'; |
|
| 247 | + $format .= $dateInterval->d.'D'; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -252,15 +252,15 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | if (0 < $dateInterval->h) { |
| 255 | - $format .= $dateInterval->h . 'H'; |
|
| 255 | + $format .= $dateInterval->h.'H'; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (0 < $dateInterval->i) { |
| 259 | - $format .= $dateInterval->i . 'M'; |
|
| 259 | + $format .= $dateInterval->i.'M'; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (0 < $dateInterval->s) { |
| 263 | - $format .= $dateInterval->s . 'S'; |
|
| 263 | + $format .= $dateInterval->s.'S'; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | if ($format === 'P') { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $metadata = new ClassMetadata($name = $class->name); |
| 47 | - if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) { |
|
| 47 | + if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) { |
|
| 48 | 48 | throw new RuntimeException(sprintf('Could not find class %s inside XML element.', $name)); |
| 49 | 49 | } |
| 50 | 50 | $elem = reset($elems); |
@@ -53,88 +53,88 @@ discard block |
||
| 53 | 53 | $metadata->fileResources[] = $class->getFileName(); |
| 54 | 54 | $exclusionPolicy = strtoupper($elem->attributes()->{'exclusion-policy'}) ?: 'NONE'; |
| 55 | 55 | $excludeAll = null !== ($exclude = $elem->attributes()->exclude) ? 'true' === strtolower($exclude) : false; |
| 56 | - $classAccessType = (string)($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 56 | + $classAccessType = (string) ($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 57 | 57 | |
| 58 | 58 | $propertiesMetadata = array(); |
| 59 | 59 | $propertiesNodes = array(); |
| 60 | 60 | |
| 61 | 61 | if (null !== $accessorOrder = $elem->attributes()->{'accessor-order'}) { |
| 62 | - $metadata->setAccessorOrder((string)$accessorOrder, preg_split('/\s*,\s*/', (string)$elem->attributes()->{'custom-accessor-order'})); |
|
| 62 | + $metadata->setAccessorOrder((string) $accessorOrder, preg_split('/\s*,\s*/', (string) $elem->attributes()->{'custom-accessor-order'})); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (null !== $xmlRootName = $elem->attributes()->{'xml-root-name'}) { |
| 66 | - $metadata->xmlRootName = (string)$xmlRootName; |
|
| 66 | + $metadata->xmlRootName = (string) $xmlRootName; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if (null !== $xmlRootNamespace = $elem->attributes()->{'xml-root-namespace'}) { |
| 70 | - $metadata->xmlRootNamespace = (string)$xmlRootNamespace; |
|
| 70 | + $metadata->xmlRootNamespace = (string) $xmlRootNamespace; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $readOnlyClass = 'true' === strtolower($elem->attributes()->{'read-only'}); |
| 74 | 74 | |
| 75 | - $discriminatorFieldName = (string)$elem->attributes()->{'discriminator-field-name'}; |
|
| 75 | + $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'}; |
|
| 76 | 76 | $discriminatorMap = array(); |
| 77 | 77 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
| 78 | - if (!isset($entry->attributes()->value)) { |
|
| 78 | + if ( ! isset($entry->attributes()->value)) { |
|
| 79 | 79 | throw new RuntimeException('Each discriminator-class element must have a "value" attribute.'); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $discriminatorMap[(string)$entry->attributes()->value] = (string)$entry; |
|
| 82 | + $discriminatorMap[(string) $entry->attributes()->value] = (string) $entry; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if ('true' === (string)$elem->attributes()->{'discriminator-disabled'}) { |
|
| 85 | + if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
|
| 86 | 86 | $metadata->discriminatorDisabled = true; |
| 87 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
| 87 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
| 88 | 88 | |
| 89 | 89 | $discriminatorGroups = array(); |
| 90 | 90 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
| 91 | - $discriminatorGroups[] = (string)$entry; |
|
| 91 | + $discriminatorGroups[] = (string) $entry; |
|
| 92 | 92 | } |
| 93 | 93 | $metadata->setDiscriminator($discriminatorFieldName, $discriminatorMap, $discriminatorGroups); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
| 97 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
| 97 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
| 98 | 98 | throw new RuntimeException('The prefix attribute must be set for all xml-namespace elements.'); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if (isset($xmlNamespace->attributes()->prefix)) { |
| 102 | - $prefix = (string)$xmlNamespace->attributes()->prefix; |
|
| 102 | + $prefix = (string) $xmlNamespace->attributes()->prefix; |
|
| 103 | 103 | } else { |
| 104 | 104 | $prefix = null; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $metadata->registerNamespace((string)$xmlNamespace->attributes()->uri, $prefix); |
|
| 107 | + $metadata->registerNamespace((string) $xmlNamespace->attributes()->uri, $prefix); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | foreach ($elem->xpath('./xml-discriminator') as $xmlDiscriminator) { |
| 111 | 111 | if (isset($xmlDiscriminator->attributes()->attribute)) { |
| 112 | - $metadata->xmlDiscriminatorAttribute = (string)$xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 112 | + $metadata->xmlDiscriminatorAttribute = (string) $xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 113 | 113 | } |
| 114 | 114 | if (isset($xmlDiscriminator->attributes()->cdata)) { |
| 115 | - $metadata->xmlDiscriminatorCData = (string)$xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 115 | + $metadata->xmlDiscriminatorCData = (string) $xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 116 | 116 | } |
| 117 | 117 | if (isset($xmlDiscriminator->attributes()->namespace)) { |
| 118 | - $metadata->xmlDiscriminatorNamespace = (string)$xmlDiscriminator->attributes()->namespace; |
|
| 118 | + $metadata->xmlDiscriminatorNamespace = (string) $xmlDiscriminator->attributes()->namespace; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | foreach ($elem->xpath('./virtual-property') as $method) { |
| 123 | 123 | |
| 124 | 124 | if (isset($method->attributes()->expression)) { |
| 125 | - $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string)$method->attributes()->name, (string)$method->attributes()->expression); |
|
| 125 | + $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string) $method->attributes()->name, (string) $method->attributes()->expression); |
|
| 126 | 126 | } else { |
| 127 | - if (!isset($method->attributes()->method)) { |
|
| 127 | + if ( ! isset($method->attributes()->method)) { |
|
| 128 | 128 | throw new RuntimeException('The method attribute must be set for all virtual-property elements.'); |
| 129 | 129 | } |
| 130 | - $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string)$method->attributes()->method); |
|
| 130 | + $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string) $method->attributes()->method); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $propertiesMetadata[] = $virtualPropertyMetadata; |
| 134 | 134 | $propertiesNodes[] = $method; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if (!$excludeAll) { |
|
| 137 | + if ( ! $excludeAll) { |
|
| 138 | 138 | |
| 139 | 139 | foreach ($class->getProperties() as $property) { |
| 140 | 140 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $propertiesMetadata[] = new PropertyMetadata($name, $pName = $property->getName()); |
| 145 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
| 145 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
| 146 | 146 | |
| 147 | 147 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
| 148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | || $pMetadata instanceof ExpressionPropertyMetadata; |
| 155 | 155 | |
| 156 | 156 | $pElem = $propertiesNodes[$propertyKey]; |
| 157 | - if (!empty($pElem)) { |
|
| 157 | + if ( ! empty($pElem)) { |
|
| 158 | 158 | |
| 159 | 159 | if (null !== $exclude = $pElem->attributes()->exclude) { |
| 160 | 160 | $isExclude = 'true' === strtolower($exclude); |
@@ -173,26 +173,26 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
| 176 | - $pMetadata->excludeIf = "!(" . $excludeIf . ")"; |
|
| 176 | + $pMetadata->excludeIf = "!(".$excludeIf.")"; |
|
| 177 | 177 | $isExpose = true; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (null !== $version = $pElem->attributes()->{'since-version'}) { |
| 181 | - $pMetadata->sinceVersion = (string)$version; |
|
| 181 | + $pMetadata->sinceVersion = (string) $version; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | if (null !== $version = $pElem->attributes()->{'until-version'}) { |
| 185 | - $pMetadata->untilVersion = (string)$version; |
|
| 185 | + $pMetadata->untilVersion = (string) $version; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if (null !== $serializedName = $pElem->attributes()->{'serialized-name'}) { |
| 189 | - $pMetadata->serializedName = (string)$serializedName; |
|
| 189 | + $pMetadata->serializedName = (string) $serializedName; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (null !== $type = $pElem->attributes()->type) { |
| 193 | - $pMetadata->setType((string)$type); |
|
| 193 | + $pMetadata->setType((string) $type); |
|
| 194 | 194 | } elseif (isset($pElem->type)) { |
| 195 | - $pMetadata->setType((string)$pElem->type); |
|
| 195 | + $pMetadata->setType((string) $pElem->type); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (null !== $groups = $pElem->attributes()->groups) { |
@@ -207,21 +207,21 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $colConfig = $pElem->{'xml-list'}; |
| 209 | 209 | if (isset($colConfig->attributes()->inline)) { |
| 210 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 210 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 214 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 214 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | if (isset($colConfig->attributes()->{'skip-when-empty'})) { |
| 218 | - $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string)$colConfig->attributes()->{'skip-when-empty'}; |
|
| 218 | + $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string) $colConfig->attributes()->{'skip-when-empty'}; |
|
| 219 | 219 | } else { |
| 220 | 220 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | if (isset($colConfig->attributes()->namespace)) { |
| 224 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 224 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -230,51 +230,51 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $colConfig = $pElem->{'xml-map'}; |
| 232 | 232 | if (isset($colConfig->attributes()->inline)) { |
| 233 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 233 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 237 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 237 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (isset($colConfig->attributes()->namespace)) { |
| 241 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 241 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | if (isset($colConfig->attributes()->{'key-attribute-name'})) { |
| 245 | - $pMetadata->xmlKeyAttribute = (string)$colConfig->attributes()->{'key-attribute-name'}; |
|
| 245 | + $pMetadata->xmlKeyAttribute = (string) $colConfig->attributes()->{'key-attribute-name'}; |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if (isset($pElem->{'xml-element'})) { |
| 250 | 250 | $colConfig = $pElem->{'xml-element'}; |
| 251 | 251 | if (isset($colConfig->attributes()->cdata)) { |
| 252 | - $pMetadata->xmlElementCData = 'true' === (string)$colConfig->attributes()->cdata; |
|
| 252 | + $pMetadata->xmlElementCData = 'true' === (string) $colConfig->attributes()->cdata; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | if (isset($colConfig->attributes()->namespace)) { |
| 256 | - $pMetadata->xmlNamespace = (string)$colConfig->attributes()->namespace; |
|
| 256 | + $pMetadata->xmlNamespace = (string) $colConfig->attributes()->namespace; |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | if (isset($pElem->attributes()->{'xml-attribute'})) { |
| 261 | - $pMetadata->xmlAttribute = 'true' === (string)$pElem->attributes()->{'xml-attribute'}; |
|
| 261 | + $pMetadata->xmlAttribute = 'true' === (string) $pElem->attributes()->{'xml-attribute'}; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | if (isset($pElem->attributes()->{'xml-attribute-map'})) { |
| 265 | - $pMetadata->xmlAttributeMap = 'true' === (string)$pElem->attributes()->{'xml-attribute-map'}; |
|
| 265 | + $pMetadata->xmlAttributeMap = 'true' === (string) $pElem->attributes()->{'xml-attribute-map'}; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | if (isset($pElem->attributes()->{'xml-value'})) { |
| 269 | - $pMetadata->xmlValue = 'true' === (string)$pElem->attributes()->{'xml-value'}; |
|
| 269 | + $pMetadata->xmlValue = 'true' === (string) $pElem->attributes()->{'xml-value'}; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (isset($pElem->attributes()->{'xml-key-value-pairs'})) { |
| 273 | - $pMetadata->xmlKeyValuePairs = 'true' === (string)$pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 273 | + $pMetadata->xmlKeyValuePairs = 'true' === (string) $pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | if (isset($pElem->attributes()->{'max-depth'})) { |
| 277 | - $pMetadata->maxDepth = (int)$pElem->attributes()->{'max-depth'}; |
|
| 277 | + $pMetadata->maxDepth = (int) $pElem->attributes()->{'max-depth'}; |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | //we need read-only before setter and getter set, because that method depends on flag being set |
@@ -287,9 +287,9 @@ discard block |
||
| 287 | 287 | $getter = $pElem->attributes()->{'accessor-getter'}; |
| 288 | 288 | $setter = $pElem->attributes()->{'accessor-setter'}; |
| 289 | 289 | $pMetadata->setAccessor( |
| 290 | - (string)($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 291 | - $getter ? (string)$getter : null, |
|
| 292 | - $setter ? (string)$setter : null |
|
| 290 | + (string) ($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 291 | + $getter ? (string) $getter : null, |
|
| 292 | + $setter ? (string) $setter : null |
|
| 293 | 293 | ); |
| 294 | 294 | |
| 295 | 295 | if (null !== $inline = $pElem->attributes()->inline) { |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if ((ExclusionPolicy::NONE === (string)$exclusionPolicy && !$isExclude) |
|
| 302 | - || (ExclusionPolicy::ALL === (string)$exclusionPolicy && $isExpose) |
|
| 301 | + if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
| 302 | + || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
|
| 303 | 303 | ) { |
| 304 | 304 | |
| 305 | 305 | $metadata->addPropertyMetadata($pMetadata); |
@@ -308,37 +308,37 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | foreach ($elem->xpath('./callback-method') as $method) { |
| 311 | - if (!isset($method->attributes()->type)) { |
|
| 311 | + if ( ! isset($method->attributes()->type)) { |
|
| 312 | 312 | throw new RuntimeException('The type attribute must be set for all callback-method elements.'); |
| 313 | 313 | } |
| 314 | - if (!isset($method->attributes()->name)) { |
|
| 314 | + if ( ! isset($method->attributes()->name)) { |
|
| 315 | 315 | throw new RuntimeException('The name attribute must be set for all callback-method elements.'); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - switch ((string)$method->attributes()->type) { |
|
| 318 | + switch ((string) $method->attributes()->type) { |
|
| 319 | 319 | case 'pre-serialize': |
| 320 | - $metadata->addPreSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 320 | + $metadata->addPreSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 321 | 321 | break; |
| 322 | 322 | |
| 323 | 323 | case 'post-serialize': |
| 324 | - $metadata->addPostSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 324 | + $metadata->addPostSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 325 | 325 | break; |
| 326 | 326 | |
| 327 | 327 | case 'post-deserialize': |
| 328 | - $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 328 | + $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 329 | 329 | break; |
| 330 | 330 | |
| 331 | 331 | case 'handler': |
| 332 | - if (!isset($method->attributes()->format)) { |
|
| 332 | + if ( ! isset($method->attributes()->format)) { |
|
| 333 | 333 | throw new RuntimeException('The format attribute must be set for "handler" callback methods.'); |
| 334 | 334 | } |
| 335 | - if (!isset($method->attributes()->direction)) { |
|
| 335 | + if ( ! isset($method->attributes()->direction)) { |
|
| 336 | 336 | throw new RuntimeException('The direction attribute must be set for "handler" callback methods.'); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - $direction = GraphNavigator::parseDirection((string)$method->attributes()->direction); |
|
| 340 | - $format = (string)$method->attributes()->format; |
|
| 341 | - $metadata->addHandlerCallback($direction, $format, (string)$method->attributes()->name); |
|
| 339 | + $direction = GraphNavigator::parseDirection((string) $method->attributes()->direction); |
|
| 340 | + $format = (string) $method->attributes()->format; |
|
| 341 | + $metadata->addHandlerCallback($direction, $format, (string) $method->attributes()->name); |
|
| 342 | 342 | |
| 343 | 343 | break; |
| 344 | 344 | |