@@ -79,7 +79,7 @@ |
||
79 | 79 | |
80 | 80 | $rs = isset($type['params'][1]) ? new \ArrayObject() : []; |
81 | 81 | |
82 | - $isList = isset($type['params'][0]) && !isset($type['params'][1]); |
|
82 | + $isList = isset($type['params'][0]) && ! isset($type['params'][1]); |
|
83 | 83 | |
84 | 84 | $elType = $this->getElementType($type); |
85 | 85 | foreach ($data as $k => $v) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | public function createRoot(?ClassMetadata $metadata = null, ?string $rootName = null, ?string $rootNamespace = null, ?string $rootPrefix = null): \DOMElement |
106 | 106 | { |
107 | - if (null !== $metadata && !empty($metadata->xmlRootName)) { |
|
107 | + if (null !== $metadata && ! empty($metadata->xmlRootName)) { |
|
108 | 108 | $rootPrefix = $metadata->xmlRootPrefix; |
109 | 109 | $rootName = $metadata->xmlRootName; |
110 | 110 | $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | $document = $this->getDocument(); |
118 | 118 | if ($rootNamespace) { |
119 | - $rootNode = $document->createElementNS($rootNamespace, (null !== $rootPrefix ? $rootPrefix . ':' : '') . $rootName); |
|
119 | + $rootNode = $document->createElementNS($rootNamespace, (null !== $rootPrefix ? $rootPrefix.':' : '').$rootName); |
|
120 | 120 | } else { |
121 | 121 | $rootNode = $document->createElement($rootName); |
122 | 122 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $decimalsNumbers = $type['params'][2] ?? null; |
191 | 191 | if ($decimalsNumbers === null) { |
192 | 192 | $parts = explode('.', (string) $dataResult); |
193 | - if (count($parts) < 2 || !$parts[1]) { |
|
193 | + if (count($parts) < 2 || ! $parts[1]) { |
|
194 | 194 | $decimalsNumbers = 1; |
195 | 195 | } |
196 | 196 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $node = $this->navigator->accept($v, $metadata->type); |
265 | 265 | $this->revertCurrentMetadata(); |
266 | 266 | |
267 | - if (!$node instanceof \DOMCharacterData) { |
|
267 | + if ( ! $node instanceof \DOMCharacterData) { |
|
268 | 268 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
269 | 269 | } |
270 | 270 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | if ( |
277 | 277 | ($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
278 | - || (!$metadata->xmlValue && $this->hasValue) |
|
278 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
279 | 279 | ) { |
280 | 280 | 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)); |
281 | 281 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $node = $this->navigator->accept($v, $metadata->type); |
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 property %s::$%s. Expected character data, but got %s.', $metadata->reflection->class, $metadata->reflection->name, \is_object($node) ? \get_class($node) : \gettype($node))); |
292 | 292 | } |
293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | if ($metadata->xmlAttributeMap) { |
300 | - if (!\is_array($v)) { |
|
300 | + if ( ! \is_array($v)) { |
|
301 | 301 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v))); |
302 | 302 | } |
303 | 303 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $node = $this->navigator->accept($value, null); |
307 | 307 | $this->revertCurrentMetadata(); |
308 | 308 | |
309 | - if (!$node instanceof \DOMCharacterData) { |
|
309 | + if ( ! $node instanceof \DOMCharacterData) { |
|
310 | 310 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
311 | 311 | } |
312 | 312 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | return; |
317 | 317 | } |
318 | 318 | |
319 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
319 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
320 | 320 | $namespace = null !== $metadata->xmlNamespace |
321 | 321 | ? $metadata->xmlNamespace |
322 | 322 | : $this->getClassDefaultNamespace($this->objectMetadataStack->top()); |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | private function isSkippableEmptyObject(?\DOMElement $node, PropertyMetadata $metadata): bool |
363 | 363 | { |
364 | - return null === $node && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
364 | + return null === $node && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | private function isSkippableCollection(PropertyMetadata $metadata): bool |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | private function isElementEmpty(\DOMElement $element): bool |
373 | 373 | { |
374 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
374 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | public function endVisitingObject(ClassMetadata $metadata, object $data, array $type): void |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
476 | 476 | $attribute = 'xmlns'; |
477 | 477 | if ('' !== $prefix) { |
478 | - $attribute .= ':' . $prefix; |
|
478 | + $attribute .= ':'.$prefix; |
|
479 | 479 | } elseif ($element->namespaceURI === $uri) { |
480 | 480 | continue; |
481 | 481 | } |
@@ -505,21 +505,21 @@ discard block |
||
505 | 505 | return $this->document->createElementNS($namespace, $tagName); |
506 | 506 | } |
507 | 507 | |
508 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
509 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
508 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
509 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
510 | 510 | } |
511 | 511 | |
512 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
512 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | private function setAttributeOnNode(\DOMElement $node, string $name, string $value, ?string $namespace = null): void |
516 | 516 | { |
517 | 517 | if (null !== $namespace) { |
518 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
519 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
518 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
519 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
520 | 520 | } |
521 | 521 | |
522 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
522 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
523 | 523 | } else { |
524 | 524 | $node->setAttribute($name, $value); |
525 | 525 | } |