@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | private function getAccessorStrategy(): AccessorStrategyInterface |
203 | 203 | { |
204 | - if (!$this->accessorStrategy) { |
|
204 | + if ( ! $this->accessorStrategy) { |
|
205 | 205 | $this->accessorStrategy = new DefaultAccessorStrategy($this->expressionEvaluator); |
206 | 206 | } |
207 | 207 | |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | |
239 | 239 | public function setCacheDir(string $dir): self |
240 | 240 | { |
241 | - if (!is_dir($dir)) { |
|
241 | + if ( ! is_dir($dir)) { |
|
242 | 242 | $this->createDir($dir); |
243 | 243 | } |
244 | 244 | |
245 | - if (!is_writable($dir)) { |
|
245 | + if ( ! is_writable($dir)) { |
|
246 | 246 | throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir)); |
247 | 247 | } |
248 | 248 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | public function setMetadataDirs(array $namespacePrefixToDirMap): self |
365 | 365 | { |
366 | 366 | foreach ($namespacePrefixToDirMap as $dir) { |
367 | - if (!is_dir($dir)) { |
|
367 | + if ( ! is_dir($dir)) { |
|
368 | 368 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
369 | 369 | } |
370 | 370 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function addMetadataDir(string $dir, string $namespacePrefix = ''): self |
404 | 404 | { |
405 | - if (!is_dir($dir)) { |
|
405 | + if ( ! is_dir($dir)) { |
|
406 | 406 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
407 | 407 | } |
408 | 408 | |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public function replaceMetadataDir(string $dir, string $namespacePrefix = ''): self |
443 | 443 | { |
444 | - if (!is_dir($dir)) { |
|
444 | + if ( ! is_dir($dir)) { |
|
445 | 445 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
446 | 446 | } |
447 | 447 | |
448 | - if (!isset($this->metadataDirs[$namespacePrefix])) { |
|
448 | + if ( ! isset($this->metadataDirs[$namespacePrefix])) { |
|
449 | 449 | throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); |
450 | 450 | } |
451 | 451 | |
@@ -511,8 +511,8 @@ discard block |
||
511 | 511 | $annotationReader = new AnnotationReader(); |
512 | 512 | |
513 | 513 | if (null !== $this->cacheDir) { |
514 | - $this->createDir($this->cacheDir . '/annotations'); |
|
515 | - $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations'); |
|
514 | + $this->createDir($this->cacheDir.'/annotations'); |
|
515 | + $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations'); |
|
516 | 516 | $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug); |
517 | 517 | } |
518 | 518 | } |
@@ -534,19 +534,19 @@ discard block |
||
534 | 534 | if (null !== $this->metadataCache) { |
535 | 535 | $metadataFactory->setCache($this->metadataCache); |
536 | 536 | } elseif (null !== $this->cacheDir) { |
537 | - $this->createDir($this->cacheDir . '/metadata'); |
|
538 | - $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata')); |
|
537 | + $this->createDir($this->cacheDir.'/metadata'); |
|
538 | + $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata')); |
|
539 | 539 | } |
540 | 540 | |
541 | - if (!$this->handlersConfigured) { |
|
541 | + if ( ! $this->handlersConfigured) { |
|
542 | 542 | $this->addDefaultHandlers(); |
543 | 543 | } |
544 | 544 | |
545 | - if (!$this->listenersConfigured) { |
|
545 | + if ( ! $this->listenersConfigured) { |
|
546 | 546 | $this->addDefaultListeners(); |
547 | 547 | } |
548 | 548 | |
549 | - if (!$this->visitorsAdded) { |
|
549 | + if ( ! $this->visitorsAdded) { |
|
550 | 550 | $this->addDefaultSerializationVisitors(); |
551 | 551 | $this->addDefaultDeserializationVisitors(); |
552 | 552 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | public function translateName(PropertyMetadata $property): string |
33 | 33 | { |
34 | - $name = preg_replace('/[A-Z]+/', $this->separator . '\\0', $property->name); |
|
34 | + $name = preg_replace('/[A-Z]+/', $this->separator.'\\0', $property->name); |
|
35 | 35 | |
36 | 36 | if ($this->lowerCase) { |
37 | 37 | return strtolower($name); |
@@ -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 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $node = $this->navigator->accept($v, $metadata->type); |
246 | 246 | $this->revertCurrentMetadata(); |
247 | 247 | |
248 | - if (!$node instanceof \DOMCharacterData) { |
|
248 | + if ( ! $node instanceof \DOMCharacterData) { |
|
249 | 249 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
250 | 250 | } |
251 | 251 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | if ( |
258 | 258 | ($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); |
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); |
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 | $namespace = null !== $metadata->xmlNamespace |
302 | 302 | ? $metadata->xmlNamespace |
303 | 303 | : $this->getClassDefaultNamespace($this->objectMetadataStack->top()); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | private function isSkippableEmptyObject(?\DOMElement $node, PropertyMetadata $metadata): bool |
344 | 344 | { |
345 | - return null === $node && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
345 | + return null === $node && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | private function isSkippableCollection(PropertyMetadata $metadata): bool |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | private function isElementEmpty(\DOMElement $element): bool |
354 | 354 | { |
355 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
355 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | public function endVisitingObject(ClassMetadata $metadata, object $data, array $type): void |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
461 | 461 | $attribute = 'xmlns'; |
462 | 462 | if ('' !== $prefix) { |
463 | - $attribute .= ':' . $prefix; |
|
463 | + $attribute .= ':'.$prefix; |
|
464 | 464 | } elseif ($element->namespaceURI === $uri) { |
465 | 465 | continue; |
466 | 466 | } |
@@ -490,21 +490,21 @@ discard block |
||
490 | 490 | return $this->document->createElementNS($namespace, $tagName); |
491 | 491 | } |
492 | 492 | |
493 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
494 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
493 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
494 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
495 | 495 | } |
496 | 496 | |
497 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
497 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | private function setAttributeOnNode(\DOMElement $node, string $name, string $value, ?string $namespace = null): void |
501 | 501 | { |
502 | 502 | if (null !== $namespace) { |
503 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
504 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
503 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
504 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
505 | 505 | } |
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 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | $accessor = $this->readAccessors[$metadata->class] ?? null; |
87 | 87 | if (null === $accessor) { |
88 | - $accessor = \Closure::bind(static function ($o, $name) { |
|
88 | + $accessor = \Closure::bind(static function($o, $name) { |
|
89 | 89 | return $o->$name; |
90 | 90 | }, null, $metadata->class); |
91 | 91 | $this->readAccessors[$metadata->class] = $accessor; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $accessor = $this->writeAccessors[$metadata->class] ?? null; |
126 | 126 | if (null === $accessor) { |
127 | - $accessor = \Closure::bind(static function ($o, $name, $value): void { |
|
127 | + $accessor = \Closure::bind(static function($o, $name, $value): void { |
|
128 | 128 | $o->$name = $value; |
129 | 129 | }, null, $metadata->class); |
130 | 130 | $this->writeAccessors[$metadata->class] = $accessor; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public static function getDefaultMethodName(string $eventName): string |
32 | 32 | { |
33 | - return 'on' . str_replace(['_', '.'], '', $eventName); |
|
33 | + return 'on'.str_replace(['_', '.'], '', $eventName); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function addSubscriber(EventSubscriberInterface $subscriber): void |
57 | 57 | { |
58 | 58 | foreach ($subscriber->getSubscribedEvents() as $eventData) { |
59 | - if (!isset($eventData['event'])) { |
|
59 | + if ( ! isset($eventData['event'])) { |
|
60 | 60 | throw new InvalidArgumentException(sprintf('Each event must have a "event" key.')); |
61 | 61 | } |
62 | 62 | |
@@ -71,33 +71,33 @@ discard block |
||
71 | 71 | |
72 | 72 | public function hasListeners(string $eventName, string $class, string $format): bool |
73 | 73 | { |
74 | - if (!isset($this->listeners[$eventName])) { |
|
74 | + if ( ! isset($this->listeners[$eventName])) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | - if (!isset($this->classListeners[$eventName][$class][$format])) { |
|
78 | + if ( ! isset($this->classListeners[$eventName][$class][$format])) { |
|
79 | 79 | $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format); |
80 | 80 | } |
81 | 81 | |
82 | - return !!$this->classListeners[$eventName][$class][$format]; |
|
82 | + return ! ! $this->classListeners[$eventName][$class][$format]; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function dispatch(string $eventName, string $class, string $format, Event $event): void |
86 | 86 | { |
87 | - if (!isset($this->listeners[$eventName])) { |
|
87 | + if ( ! isset($this->listeners[$eventName])) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
91 | 91 | $object = $event instanceof ObjectEvent ? $event->getObject() : null; |
92 | 92 | $realClass = is_object($object) ? get_class($object) : ''; |
93 | - $objectClass = $realClass !== $class ? $realClass . $class : $class; |
|
93 | + $objectClass = $realClass !== $class ? $realClass.$class : $class; |
|
94 | 94 | |
95 | - if (!isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
95 | + if ( ! isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
96 | 96 | $this->classListeners[$eventName][$objectClass][$format] = $this->initializeListeners($eventName, $class, $format); |
97 | 97 | } |
98 | 98 | |
99 | 99 | foreach ($this->classListeners[$eventName][$objectClass][$format] as $listener) { |
100 | - if (!empty($listener[3]) && !($object instanceof $listener[3])) { |
|
100 | + if ( ! empty($listener[3]) && ! ($object instanceof $listener[3])) { |
|
101 | 101 | continue; |
102 | 102 | } |
103 | 103 |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not |
41 | 41 | // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created, |
42 | 42 | // so it must be loaded if its a real class. |
43 | - $virtualType = !class_exists($type['name'], false); |
|
43 | + $virtualType = ! class_exists($type['name'], false); |
|
44 | 44 | |
45 | 45 | if ( |
46 | 46 | $object instanceof PersistentCollection |
47 | 47 | || $object instanceof MongoDBPersistentCollection |
48 | 48 | || $object instanceof PHPCRPersistentCollection |
49 | 49 | ) { |
50 | - if (!$virtualType) { |
|
50 | + if ( ! $virtualType) { |
|
51 | 51 | $event->setType('ArrayCollection'); |
52 | 52 | } |
53 | 53 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | |
57 | 57 | if ( |
58 | 58 | ($this->skipVirtualTypeInit && $virtualType) || |
59 | - (!$object instanceof Proxy && !$object instanceof LazyLoadingInterface) |
|
59 | + ( ! $object instanceof Proxy && ! $object instanceof LazyLoadingInterface) |
|
60 | 60 | ) { |
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // do not initialize the proxy if is going to be excluded by-class by some exclusion strategy |
65 | - if (false === $this->initializeExcluded && !$virtualType) { |
|
65 | + if (false === $this->initializeExcluded && ! $virtualType) { |
|
66 | 66 | $context = $event->getContext(); |
67 | 67 | $exclusionStrategy = $context->getExclusionStrategy(); |
68 | 68 | $metadata = $context->getMetadataFactory()->getMetadataForClass(get_parent_class($object)); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $object->__load(); |
78 | 78 | } |
79 | 79 | |
80 | - if (!$virtualType) { |
|
80 | + if ( ! $virtualType) { |
|
81 | 81 | $event->setType(get_parent_class($object), $type['params']); |
82 | 82 | } |
83 | 83 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $type = $event->getType(); |
88 | 88 | // is a virtual type? then there is no need to change the event name |
89 | - if (!class_exists($type['name'], false)) { |
|
89 | + if ( ! class_exists($type['name'], false)) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | 92 |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | switch ($type['name']) { |
136 | 136 | case 'NULL': |
137 | - if (!$this->shouldSerializeNull && !$this->isRootNullAllowed()) { |
|
137 | + if ( ! $this->shouldSerializeNull && ! $this->isRootNullAllowed()) { |
|
138 | 138 | throw new NotAcceptableException(); |
139 | 139 | } |
140 | 140 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | case 'resource': |
165 | 165 | $msg = 'Resources are not supported in serialized data.'; |
166 | 166 | if (null !== $path = $this->context->getPath()) { |
167 | - $msg .= ' Path: ' . $path; |
|
167 | + $msg .= ' Path: '.$path; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | throw new RuntimeException($msg); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | // Locate possible ObjectManager |
66 | 66 | $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); |
67 | 67 | |
68 | - if (!$objectManager) { |
|
68 | + if ( ! $objectManager) { |
|
69 | 69 | // No ObjectManager found, proceed with normal deserialization |
70 | 70 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
71 | 71 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | // Managed entity, check for proxy load |
82 | - if (!\is_array($data) && !(is_object($data) && 'SimpleXMLElement' === get_class($data))) { |
|
82 | + if ( ! \is_array($data) && ! (is_object($data) && 'SimpleXMLElement' === get_class($data))) { |
|
83 | 83 | // Single identifier, load proxy |
84 | 84 | return $objectManager->getReference($metadata->name, $data); |
85 | 85 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | foreach ($classMetadata->getIdentifierFieldNames() as $name) { |
92 | 92 | // Avoid calling objectManager->find if some identification properties are excluded |
93 | - if (!isset($metadata->propertyMetadata[$name])) { |
|
93 | + if ( ! isset($metadata->propertyMetadata[$name])) { |
|
94 | 94 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
95 | 95 | } |
96 | 96 | |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
102 | 102 | } |
103 | 103 | |
104 | - if (is_array($data) && !array_key_exists($propertyMetadata->serializedName, $data)) { |
|
104 | + if (is_array($data) && ! array_key_exists($propertyMetadata->serializedName, $data)) { |
|
105 | 105 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
106 | - } elseif (is_object($data) && !property_exists($data, $propertyMetadata->serializedName)) { |
|
106 | + } elseif (is_object($data) && ! property_exists($data, $propertyMetadata->serializedName)) { |
|
107 | 107 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
108 | 108 | } |
109 | 109 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | if (false !== stripos($data, '<!doctype')) { |
86 | 86 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
87 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
87 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
88 | 88 | throw new InvalidArgumentException(sprintf( |
89 | 89 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
90 | 90 | $internalSubset |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $nodes = $data->xpath($entryName); |
210 | 210 | } |
211 | 211 | |
212 | - if (null === $nodes || !\count($nodes)) { |
|
212 | + if (null === $nodes || ! \count($nodes)) { |
|
213 | 213 | return []; |
214 | 214 | } |
215 | 215 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $nodes = $data->children($namespace)->$entryName; |
238 | 238 | foreach ($nodes as $v) { |
239 | 239 | $attrs = $v->attributes(); |
240 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
240 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
241 | 241 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
242 | 242 | } |
243 | 243 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
268 | 268 | |
269 | 269 | // Check XML element with namespace for discriminatorFieldName |
270 | - case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
270 | + case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
271 | 271 | return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
272 | 272 | |
273 | 273 | // Check XML element for discriminatorFieldName |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $name = $metadata->serializedName; |
298 | 298 | |
299 | 299 | if (true === $metadata->inline) { |
300 | - if (!$metadata->type) { |
|
300 | + if ( ! $metadata->type) { |
|
301 | 301 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
302 | 302 | } |
303 | 303 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | if ($metadata->xmlAttribute) { |
308 | 308 | $attributes = $data->attributes($metadata->xmlNamespace); |
309 | 309 | if (isset($attributes[$name])) { |
310 | - if (!$metadata->type) { |
|
310 | + if ( ! $metadata->type) { |
|
311 | 311 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
312 | 312 | } |
313 | 313 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | if ($metadata->xmlValue) { |
321 | - if (!$metadata->type) { |
|
321 | + if ( ! $metadata->type) { |
|
322 | 322 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
323 | 323 | } |
324 | 324 | |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | |
328 | 328 | if ($metadata->xmlCollection) { |
329 | 329 | $enclosingElem = $data; |
330 | - if (!$metadata->xmlCollectionInline) { |
|
330 | + if ( ! $metadata->xmlCollectionInline) { |
|
331 | 331 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
332 | 332 | } |
333 | 333 | |
334 | 334 | $this->setCurrentMetadata($metadata); |
335 | - if (!$metadata->type) { |
|
335 | + if ( ! $metadata->type) { |
|
336 | 336 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
337 | 337 | } |
338 | 338 | |
@@ -344,13 +344,13 @@ discard block |
||
344 | 344 | |
345 | 345 | if ($metadata->xmlNamespace) { |
346 | 346 | $node = $data->children($metadata->xmlNamespace)->$name; |
347 | - if (!$node->count()) { |
|
347 | + if ( ! $node->count()) { |
|
348 | 348 | throw new NotAcceptableException(); |
349 | 349 | } |
350 | 350 | } elseif ('' === $metadata->xmlNamespace) { |
351 | 351 | // See #1087 - element must be like: <element xmlns="" /> - https://www.w3.org/TR/REC-xml-names/#iri-use |
352 | 352 | // Use of an empty string in a namespace declaration turns it into an "undeclaration". |
353 | - $nodes = $data->xpath('./' . $name); |
|
353 | + $nodes = $data->xpath('./'.$name); |
|
354 | 354 | if (empty($nodes)) { |
355 | 355 | throw new NotAcceptableException(); |
356 | 356 | } |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | if (isset($namespaces[''])) { |
362 | 362 | $prefix = uniqid('ns-'); |
363 | 363 | $data->registerXPathNamespace($prefix, $namespaces['']); |
364 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
364 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
365 | 365 | } else { |
366 | - $nodes = $data->xpath('./' . $name); |
|
366 | + $nodes = $data->xpath('./'.$name); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | if (empty($nodes)) { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $this->setCurrentMetadata($metadata); |
378 | 378 | } |
379 | 379 | |
380 | - if (!$metadata->type) { |
|
380 | + if ( ! $metadata->type) { |
|
381 | 381 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
382 | 382 | } |
383 | 383 |