@@ -47,6 +47,9 @@ discard block |
||
47 | 47 | /** @var boolean */ |
48 | 48 | private $formatOutput; |
49 | 49 | |
50 | + /** |
|
51 | + * @param Naming\PropertyNamingStrategyInterface $namingStrategy |
|
52 | + */ |
|
50 | 53 | public function __construct($namingStrategy) |
51 | 54 | { |
52 | 55 | parent::__construct($namingStrategy); |
@@ -130,6 +133,9 @@ discard block |
||
130 | 133 | return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
131 | 134 | } |
132 | 135 | |
136 | + /** |
|
137 | + * @param string $data |
|
138 | + */ |
|
133 | 139 | public function visitSimpleString($data, array $type, Context $context) |
134 | 140 | { |
135 | 141 | if (null === $this->document) { |
@@ -476,6 +482,9 @@ discard block |
||
476 | 482 | return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
477 | 483 | } |
478 | 484 | |
485 | + /** |
|
486 | + * @param string $value |
|
487 | + */ |
|
479 | 488 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
480 | 489 | { |
481 | 490 | if (null !== $namespace) { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $this->document = $this->createDocument(null, null, false); |
207 | 207 | if ($metadata->xmlRootName) { |
208 | 208 | $rootName = $metadata->xmlRootName; |
209 | - $rootNamespace = $metadata->xmlRootNamespace?:$this->getClassDefaultNamespace($metadata); |
|
209 | + $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata); |
|
210 | 210 | } else { |
211 | 211 | $rootName = $this->defaultRootName; |
212 | 212 | $rootNamespace = $this->defaultRootNamespace; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | return; |
290 | 290 | } |
291 | 291 | |
292 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
292 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
293 | 293 | $elementName = $this->namingStrategy->translateName($metadata); |
294 | 294 | |
295 | 295 | $namespace = null !== $metadata->xmlNamespace |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | private function isElementEmpty(\DOMElement $element) |
334 | 334 | { |
335 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
335 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context) |
@@ -470,17 +470,17 @@ discard block |
||
470 | 470 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
471 | 471 | return $this->document->createElementNS($namespace, $tagName); |
472 | 472 | } |
473 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
474 | - $prefix = 'ns-'. substr(sha1($namespace), 0, 8); |
|
473 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
474 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
475 | 475 | } |
476 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
476 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
480 | 480 | { |
481 | 481 | if (null !== $namespace) { |
482 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
483 | - $prefix = 'ns-'. substr(sha1($namespace), 0, 8); |
|
482 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
483 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
484 | 484 | } |
485 | 485 | $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
486 | 486 | } else { |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | |
491 | 491 | private function getClassDefaultNamespace(ClassMetadata $metadata) |
492 | 492 | { |
493 | - return (isset($metadata->xmlNamespaces[''])?$metadata->xmlNamespaces['']:null); |
|
493 | + return (isset($metadata->xmlNamespaces['']) ? $metadata->xmlNamespaces[''] : null); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | /** |