@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | private function getAccessorStrategy() |
117 | 117 | { |
118 | - if (!$this->accessorStrategy) { |
|
118 | + if ( ! $this->accessorStrategy) { |
|
119 | 119 | $this->accessorStrategy = new DefaultAccessorStrategy(); |
120 | 120 | |
121 | 121 | if ($this->expressionEvaluator) { |
@@ -148,17 +148,17 @@ discard block |
||
148 | 148 | |
149 | 149 | public function setDebug($bool) |
150 | 150 | { |
151 | - $this->debug = (boolean)$bool; |
|
151 | + $this->debug = (boolean) $bool; |
|
152 | 152 | |
153 | 153 | return $this; |
154 | 154 | } |
155 | 155 | |
156 | 156 | public function setCacheDir($dir) |
157 | 157 | { |
158 | - if (!is_dir($dir)) { |
|
158 | + if ( ! is_dir($dir)) { |
|
159 | 159 | $this->createDir($dir); |
160 | 160 | } |
161 | - if (!is_writable($dir)) { |
|
161 | + if ( ! is_writable($dir)) { |
|
162 | 162 | throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir)); |
163 | 163 | } |
164 | 164 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function includeInterfaceMetadata($include) |
262 | 262 | { |
263 | - $this->includeInterfaceMetadata = (Boolean)$include; |
|
263 | + $this->includeInterfaceMetadata = (Boolean) $include; |
|
264 | 264 | |
265 | 265 | return $this; |
266 | 266 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | public function setMetadataDirs(array $namespacePrefixToDirMap) |
280 | 280 | { |
281 | 281 | foreach ($namespacePrefixToDirMap as $dir) { |
282 | - if (!is_dir($dir)) { |
|
282 | + if ( ! is_dir($dir)) { |
|
283 | 283 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
284 | 284 | } |
285 | 285 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function addMetadataDir($dir, $namespacePrefix = '') |
319 | 319 | { |
320 | - if (!is_dir($dir)) { |
|
320 | + if ( ! is_dir($dir)) { |
|
321 | 321 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
322 | 322 | } |
323 | 323 | |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | */ |
360 | 360 | public function replaceMetadataDir($dir, $namespacePrefix = '') |
361 | 361 | { |
362 | - if (!is_dir($dir)) { |
|
362 | + if ( ! is_dir($dir)) { |
|
363 | 363 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
364 | 364 | } |
365 | 365 | |
366 | - if (!isset($this->metadataDirs[$namespacePrefix])) { |
|
366 | + if ( ! isset($this->metadataDirs[$namespacePrefix])) { |
|
367 | 367 | throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); |
368 | 368 | } |
369 | 369 | |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | $annotationReader = new AnnotationReader(); |
427 | 427 | |
428 | 428 | if (null !== $this->cacheDir) { |
429 | - $this->createDir($this->cacheDir . '/annotations'); |
|
430 | - $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations'); |
|
429 | + $this->createDir($this->cacheDir.'/annotations'); |
|
430 | + $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations'); |
|
431 | 431 | $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug); |
432 | 432 | } |
433 | 433 | } |
@@ -443,19 +443,19 @@ discard block |
||
443 | 443 | $metadataFactory->setIncludeInterfaces($this->includeInterfaceMetadata); |
444 | 444 | |
445 | 445 | if (null !== $this->cacheDir) { |
446 | - $this->createDir($this->cacheDir . '/metadata'); |
|
447 | - $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata')); |
|
446 | + $this->createDir($this->cacheDir.'/metadata'); |
|
447 | + $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata')); |
|
448 | 448 | } |
449 | 449 | |
450 | - if (!$this->handlersConfigured) { |
|
450 | + if ( ! $this->handlersConfigured) { |
|
451 | 451 | $this->addDefaultHandlers(); |
452 | 452 | } |
453 | 453 | |
454 | - if (!$this->listenersConfigured) { |
|
454 | + if ( ! $this->listenersConfigured) { |
|
455 | 455 | $this->addDefaultListeners(); |
456 | 456 | } |
457 | 457 | |
458 | - if (!$this->visitorsAdded) { |
|
458 | + if ( ! $this->visitorsAdded) { |
|
459 | 459 | $this->addDefaultSerializationVisitors(); |
460 | 460 | $this->addDefaultDeserializationVisitors(); |
461 | 461 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | private $namingStrategy; |
44 | 44 | |
45 | - public function __construct(FileLocatorInterface $locator, PropertyNamingStrategyInterface $namingStrategy, AbstractParser $typeParser = null) |
|
45 | + public function __construct(FileLocatorInterface $locator, PropertyNamingStrategyInterface $namingStrategy, AbstractParser $typeParser = null) |
|
46 | 46 | { |
47 | 47 | parent::__construct($locator); |
48 | 48 | $this->typeParser = $typeParser ?: new TypeParser(); |
@@ -62,97 +62,97 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | $metadata = new ClassMetadata($name = $class->name); |
65 | - if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) { |
|
65 | + if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) { |
|
66 | 66 | throw new RuntimeException(sprintf('Could not find class %s inside XML element.', $name)); |
67 | 67 | } |
68 | 68 | $elem = reset($elems); |
69 | 69 | |
70 | 70 | $metadata->fileResources[] = $path; |
71 | 71 | $metadata->fileResources[] = $class->getFileName(); |
72 | - $exclusionPolicy = strtoupper((string)$elem->attributes()->{'exclusion-policy'}) ?: 'NONE'; |
|
73 | - $excludeAll = null !== ($exclude = $elem->attributes()->exclude) ? 'true' === strtolower((string)$exclude) : false; |
|
74 | - $classAccessType = (string)($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
72 | + $exclusionPolicy = strtoupper((string) $elem->attributes()->{'exclusion-policy'}) ?: 'NONE'; |
|
73 | + $excludeAll = null !== ($exclude = $elem->attributes()->exclude) ? 'true' === strtolower((string) $exclude) : false; |
|
74 | + $classAccessType = (string) ($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
75 | 75 | |
76 | 76 | $propertiesMetadata = array(); |
77 | 77 | $propertiesNodes = array(); |
78 | 78 | |
79 | 79 | if (null !== $accessorOrder = $elem->attributes()->{'accessor-order'}) { |
80 | - $metadata->setAccessorOrder((string)$accessorOrder, preg_split('/\s*,\s*/', (string)$elem->attributes()->{'custom-accessor-order'})); |
|
80 | + $metadata->setAccessorOrder((string) $accessorOrder, preg_split('/\s*,\s*/', (string) $elem->attributes()->{'custom-accessor-order'})); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | if (null !== $xmlRootName = $elem->attributes()->{'xml-root-name'}) { |
84 | - $metadata->xmlRootName = (string)$xmlRootName; |
|
84 | + $metadata->xmlRootName = (string) $xmlRootName; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | if (null !== $xmlRootNamespace = $elem->attributes()->{'xml-root-namespace'}) { |
88 | - $metadata->xmlRootNamespace = (string)$xmlRootNamespace; |
|
88 | + $metadata->xmlRootNamespace = (string) $xmlRootNamespace; |
|
89 | 89 | } |
90 | 90 | |
91 | - $readOnlyClass = 'true' === strtolower((string)$elem->attributes()->{'read-only'}); |
|
91 | + $readOnlyClass = 'true' === strtolower((string) $elem->attributes()->{'read-only'}); |
|
92 | 92 | |
93 | - $discriminatorFieldName = (string)$elem->attributes()->{'discriminator-field-name'}; |
|
93 | + $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'}; |
|
94 | 94 | $discriminatorMap = array(); |
95 | 95 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
96 | - if (!isset($entry->attributes()->value)) { |
|
96 | + if ( ! isset($entry->attributes()->value)) { |
|
97 | 97 | throw new RuntimeException('Each discriminator-class element must have a "value" attribute.'); |
98 | 98 | } |
99 | 99 | |
100 | - $discriminatorMap[(string)$entry->attributes()->value] = (string)$entry; |
|
100 | + $discriminatorMap[(string) $entry->attributes()->value] = (string) $entry; |
|
101 | 101 | } |
102 | 102 | |
103 | - if ('true' === (string)$elem->attributes()->{'discriminator-disabled'}) { |
|
103 | + if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
|
104 | 104 | $metadata->discriminatorDisabled = true; |
105 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
105 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
106 | 106 | |
107 | 107 | $discriminatorGroups = array(); |
108 | 108 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
109 | - $discriminatorGroups[] = (string)$entry; |
|
109 | + $discriminatorGroups[] = (string) $entry; |
|
110 | 110 | } |
111 | 111 | $metadata->setDiscriminator($discriminatorFieldName, $discriminatorMap, $discriminatorGroups); |
112 | 112 | } |
113 | 113 | |
114 | 114 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
115 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
115 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
116 | 116 | throw new RuntimeException('The prefix attribute must be set for all xml-namespace elements.'); |
117 | 117 | } |
118 | 118 | |
119 | 119 | if (isset($xmlNamespace->attributes()->prefix)) { |
120 | - $prefix = (string)$xmlNamespace->attributes()->prefix; |
|
120 | + $prefix = (string) $xmlNamespace->attributes()->prefix; |
|
121 | 121 | } else { |
122 | 122 | $prefix = null; |
123 | 123 | } |
124 | 124 | |
125 | - $metadata->registerNamespace((string)$xmlNamespace->attributes()->uri, $prefix); |
|
125 | + $metadata->registerNamespace((string) $xmlNamespace->attributes()->uri, $prefix); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | foreach ($elem->xpath('./xml-discriminator') as $xmlDiscriminator) { |
129 | 129 | if (isset($xmlDiscriminator->attributes()->attribute)) { |
130 | - $metadata->xmlDiscriminatorAttribute = (string)$xmlDiscriminator->attributes()->attribute === 'true'; |
|
130 | + $metadata->xmlDiscriminatorAttribute = (string) $xmlDiscriminator->attributes()->attribute === 'true'; |
|
131 | 131 | } |
132 | 132 | if (isset($xmlDiscriminator->attributes()->cdata)) { |
133 | - $metadata->xmlDiscriminatorCData = (string)$xmlDiscriminator->attributes()->cdata === 'true'; |
|
133 | + $metadata->xmlDiscriminatorCData = (string) $xmlDiscriminator->attributes()->cdata === 'true'; |
|
134 | 134 | } |
135 | 135 | if (isset($xmlDiscriminator->attributes()->namespace)) { |
136 | - $metadata->xmlDiscriminatorNamespace = (string)$xmlDiscriminator->attributes()->namespace; |
|
136 | + $metadata->xmlDiscriminatorNamespace = (string) $xmlDiscriminator->attributes()->namespace; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | 140 | foreach ($elem->xpath('./virtual-property') as $method) { |
141 | 141 | |
142 | 142 | if (isset($method->attributes()->expression)) { |
143 | - $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string)$method->attributes()->name, (string)$method->attributes()->expression); |
|
143 | + $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string) $method->attributes()->name, (string) $method->attributes()->expression); |
|
144 | 144 | } else { |
145 | - if (!isset($method->attributes()->method)) { |
|
145 | + if ( ! isset($method->attributes()->method)) { |
|
146 | 146 | throw new RuntimeException('The method attribute must be set for all virtual-property elements.'); |
147 | 147 | } |
148 | - $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string)$method->attributes()->method); |
|
148 | + $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string) $method->attributes()->method); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | $propertiesMetadata[] = $virtualPropertyMetadata; |
152 | 152 | $propertiesNodes[] = $method; |
153 | 153 | } |
154 | 154 | |
155 | - if (!$excludeAll) { |
|
155 | + if ( ! $excludeAll) { |
|
156 | 156 | |
157 | 157 | foreach ($class->getProperties() as $property) { |
158 | 158 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $propertiesMetadata[] = new PropertyMetadata($name, $pName = $property->getName()); |
163 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
163 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
164 | 164 | |
165 | 165 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
166 | 166 | } |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | || $pMetadata instanceof ExpressionPropertyMetadata; |
173 | 173 | |
174 | 174 | $pElem = $propertiesNodes[$propertyKey]; |
175 | - if (!empty($pElem)) { |
|
175 | + if ( ! empty($pElem)) { |
|
176 | 176 | |
177 | 177 | if (null !== $exclude = $pElem->attributes()->exclude) { |
178 | - $isExclude = 'true' === strtolower((string)$exclude); |
|
178 | + $isExclude = 'true' === strtolower((string) $exclude); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | if ($isExclude) { |
@@ -183,42 +183,42 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | if (null !== $expose = $pElem->attributes()->expose) { |
186 | - $isExpose = 'true' === strtolower((string)$expose); |
|
186 | + $isExpose = 'true' === strtolower((string) $expose); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | if (null !== $excludeIf = $pElem->attributes()->{'exclude-if'}) { |
190 | - $pMetadata->excludeIf = (string)$excludeIf; |
|
190 | + $pMetadata->excludeIf = (string) $excludeIf; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | if (null !== $skip = $pElem->attributes()->{'skip-when-empty'}) { |
194 | - $pMetadata->skipWhenEmpty = 'true' === strtolower((string)$skip); |
|
194 | + $pMetadata->skipWhenEmpty = 'true' === strtolower((string) $skip); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
198 | - $pMetadata->excludeIf = "!(" . (string)$excludeIf . ")"; |
|
198 | + $pMetadata->excludeIf = "!(".(string) $excludeIf.")"; |
|
199 | 199 | $isExpose = true; |
200 | 200 | } |
201 | 201 | |
202 | 202 | if (null !== $version = $pElem->attributes()->{'since-version'}) { |
203 | - $pMetadata->sinceVersion = (string)$version; |
|
203 | + $pMetadata->sinceVersion = (string) $version; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | if (null !== $version = $pElem->attributes()->{'until-version'}) { |
207 | - $pMetadata->untilVersion = (string)$version; |
|
207 | + $pMetadata->untilVersion = (string) $version; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | if (null !== $serializedName = $pElem->attributes()->{'serialized-name'}) { |
211 | - $pMetadata->serializedName = (string)$serializedName; |
|
211 | + $pMetadata->serializedName = (string) $serializedName; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | if (null !== $type = $pElem->attributes()->type) { |
215 | - $pMetadata->setType($this->typeParser->parse((string)$type)); |
|
215 | + $pMetadata->setType($this->typeParser->parse((string) $type)); |
|
216 | 216 | } elseif (isset($pElem->type)) { |
217 | - $pMetadata->setType($this->typeParser->parse((string)$pElem->type)); |
|
217 | + $pMetadata->setType($this->typeParser->parse((string) $pElem->type)); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | if (null !== $groups = $pElem->attributes()->groups) { |
221 | - $pMetadata->groups = preg_split('/\s*,\s*/', trim((string)$groups)); |
|
221 | + $pMetadata->groups = preg_split('/\s*,\s*/', trim((string) $groups)); |
|
222 | 222 | } elseif (isset($pElem->groups)) { |
223 | 223 | $pMetadata->groups = (array) $pElem->groups->value; |
224 | 224 | } |
@@ -229,21 +229,21 @@ discard block |
||
229 | 229 | |
230 | 230 | $colConfig = $pElem->{'xml-list'}; |
231 | 231 | if (isset($colConfig->attributes()->inline)) { |
232 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
232 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | if (isset($colConfig->attributes()->{'entry-name'})) { |
236 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
236 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | if (isset($colConfig->attributes()->{'skip-when-empty'})) { |
240 | - $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string)$colConfig->attributes()->{'skip-when-empty'}; |
|
240 | + $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string) $colConfig->attributes()->{'skip-when-empty'}; |
|
241 | 241 | } else { |
242 | 242 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
243 | 243 | } |
244 | 244 | |
245 | 245 | if (isset($colConfig->attributes()->namespace)) { |
246 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
246 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
@@ -252,56 +252,56 @@ discard block |
||
252 | 252 | |
253 | 253 | $colConfig = $pElem->{'xml-map'}; |
254 | 254 | if (isset($colConfig->attributes()->inline)) { |
255 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
255 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | if (isset($colConfig->attributes()->{'entry-name'})) { |
259 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
259 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | if (isset($colConfig->attributes()->namespace)) { |
263 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
263 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | if (isset($colConfig->attributes()->{'key-attribute-name'})) { |
267 | - $pMetadata->xmlKeyAttribute = (string)$colConfig->attributes()->{'key-attribute-name'}; |
|
267 | + $pMetadata->xmlKeyAttribute = (string) $colConfig->attributes()->{'key-attribute-name'}; |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
271 | 271 | if (isset($pElem->{'xml-element'})) { |
272 | 272 | $colConfig = $pElem->{'xml-element'}; |
273 | 273 | if (isset($colConfig->attributes()->cdata)) { |
274 | - $pMetadata->xmlElementCData = 'true' === (string)$colConfig->attributes()->cdata; |
|
274 | + $pMetadata->xmlElementCData = 'true' === (string) $colConfig->attributes()->cdata; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | if (isset($colConfig->attributes()->namespace)) { |
278 | - $pMetadata->xmlNamespace = (string)$colConfig->attributes()->namespace; |
|
278 | + $pMetadata->xmlNamespace = (string) $colConfig->attributes()->namespace; |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | 282 | if (isset($pElem->attributes()->{'xml-attribute'})) { |
283 | - $pMetadata->xmlAttribute = 'true' === (string)$pElem->attributes()->{'xml-attribute'}; |
|
283 | + $pMetadata->xmlAttribute = 'true' === (string) $pElem->attributes()->{'xml-attribute'}; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | if (isset($pElem->attributes()->{'xml-attribute-map'})) { |
287 | - $pMetadata->xmlAttributeMap = 'true' === (string)$pElem->attributes()->{'xml-attribute-map'}; |
|
287 | + $pMetadata->xmlAttributeMap = 'true' === (string) $pElem->attributes()->{'xml-attribute-map'}; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | if (isset($pElem->attributes()->{'xml-value'})) { |
291 | - $pMetadata->xmlValue = 'true' === (string)$pElem->attributes()->{'xml-value'}; |
|
291 | + $pMetadata->xmlValue = 'true' === (string) $pElem->attributes()->{'xml-value'}; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | if (isset($pElem->attributes()->{'xml-key-value-pairs'})) { |
295 | - $pMetadata->xmlKeyValuePairs = 'true' === (string)$pElem->attributes()->{'xml-key-value-pairs'}; |
|
295 | + $pMetadata->xmlKeyValuePairs = 'true' === (string) $pElem->attributes()->{'xml-key-value-pairs'}; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | if (isset($pElem->attributes()->{'max-depth'})) { |
299 | - $pMetadata->maxDepth = (int)$pElem->attributes()->{'max-depth'}; |
|
299 | + $pMetadata->maxDepth = (int) $pElem->attributes()->{'max-depth'}; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | //we need read-only before setter and getter set, because that method depends on flag being set |
303 | 303 | if (null !== $readOnly = $pElem->attributes()->{'read-only'}) { |
304 | - $pMetadata->readOnly = 'true' === strtolower((string)$readOnly); |
|
304 | + $pMetadata->readOnly = 'true' === strtolower((string) $readOnly); |
|
305 | 305 | } else { |
306 | 306 | $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass; |
307 | 307 | } |
@@ -309,26 +309,26 @@ discard block |
||
309 | 309 | $getter = $pElem->attributes()->{'accessor-getter'}; |
310 | 310 | $setter = $pElem->attributes()->{'accessor-setter'}; |
311 | 311 | $pMetadata->setAccessor( |
312 | - (string)($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
313 | - $getter ? (string)$getter : null, |
|
314 | - $setter ? (string)$setter : null |
|
312 | + (string) ($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
313 | + $getter ? (string) $getter : null, |
|
314 | + $setter ? (string) $setter : null |
|
315 | 315 | ); |
316 | 316 | |
317 | 317 | if (null !== $inline = $pElem->attributes()->inline) { |
318 | - $pMetadata->inline = 'true' === strtolower((string)$inline); |
|
318 | + $pMetadata->inline = 'true' === strtolower((string) $inline); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | - if (!$pMetadata->serializedName) { |
|
322 | + if ( ! $pMetadata->serializedName) { |
|
323 | 323 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
324 | 324 | } |
325 | 325 | |
326 | - if (!empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
327 | - $pMetadata->name = (string)$name; |
|
326 | + if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
327 | + $pMetadata->name = (string) $name; |
|
328 | 328 | } |
329 | 329 | |
330 | - if ((ExclusionPolicy::NONE === (string)$exclusionPolicy && !$isExclude) |
|
331 | - || (ExclusionPolicy::ALL === (string)$exclusionPolicy && $isExpose) |
|
330 | + if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
331 | + || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
|
332 | 332 | ) { |
333 | 333 | |
334 | 334 | |
@@ -338,31 +338,31 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | foreach ($elem->xpath('./callback-method') as $method) { |
341 | - if (!isset($method->attributes()->type)) { |
|
341 | + if ( ! isset($method->attributes()->type)) { |
|
342 | 342 | throw new RuntimeException('The type attribute must be set for all callback-method elements.'); |
343 | 343 | } |
344 | - if (!isset($method->attributes()->name)) { |
|
344 | + if ( ! isset($method->attributes()->name)) { |
|
345 | 345 | throw new RuntimeException('The name attribute must be set for all callback-method elements.'); |
346 | 346 | } |
347 | 347 | |
348 | - switch ((string)$method->attributes()->type) { |
|
348 | + switch ((string) $method->attributes()->type) { |
|
349 | 349 | case 'pre-serialize': |
350 | - $metadata->addPreSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
350 | + $metadata->addPreSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
351 | 351 | break; |
352 | 352 | |
353 | 353 | case 'post-serialize': |
354 | - $metadata->addPostSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
354 | + $metadata->addPostSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
355 | 355 | break; |
356 | 356 | |
357 | 357 | case 'post-deserialize': |
358 | - $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
358 | + $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
359 | 359 | break; |
360 | 360 | |
361 | 361 | case 'handler': |
362 | - if (!isset($method->attributes()->format)) { |
|
362 | + if ( ! isset($method->attributes()->format)) { |
|
363 | 363 | throw new RuntimeException('The format attribute must be set for "handler" callback methods.'); |
364 | 364 | } |
365 | - if (!isset($method->attributes()->direction)) { |
|
365 | + if ( ! isset($method->attributes()->direction)) { |
|
366 | 366 | throw new RuntimeException('The direction attribute must be set for "handler" callback methods.'); |
367 | 367 | } |
368 | 368 |
@@ -53,32 +53,32 @@ discard block |
||
53 | 53 | |
54 | 54 | public function visitString($data, array $type): string |
55 | 55 | { |
56 | - return (string)$data; |
|
56 | + return (string) $data; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public function visitBoolean($data, array $type): bool |
60 | 60 | { |
61 | - return (bool)$data; |
|
61 | + return (bool) $data; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function visitInteger($data, array $type): int |
65 | 65 | { |
66 | - return (int)$data; |
|
66 | + return (int) $data; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function visitDouble($data, array $type): float |
70 | 70 | { |
71 | - return (double)$data; |
|
71 | + return (double) $data; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function visitArray($data, array $type): array |
75 | 75 | { |
76 | - if (!\is_array($data)) { |
|
76 | + if ( ! \is_array($data)) { |
|
77 | 77 | throw new RuntimeException(sprintf('Expected array, but got %s: %s', \gettype($data), json_encode($data))); |
78 | 78 | } |
79 | 79 | |
80 | 80 | // If no further parameters were given, keys/values are just passed as is. |
81 | - if (!$type['params']) { |
|
81 | + if ( ! $type['params']) { |
|
82 | 82 | return $data; |
83 | 83 | } |
84 | 84 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): string |
114 | 114 | { |
115 | 115 | if (isset($data[$metadata->discriminatorFieldName])) { |
116 | - return (string)$data[$metadata->discriminatorFieldName]; |
|
116 | + return (string) $data[$metadata->discriminatorFieldName]; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | throw new LogicException(sprintf( |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
139 | - if (!\is_array($data)) { |
|
139 | + if ( ! \is_array($data)) { |
|
140 | 140 | throw new RuntimeException(sprintf('Invalid data "%s"(%s), expected "%s".', $data, $metadata->type['name'], $metadata->reflection->class)); |
141 | 141 | } |
142 | 142 | |
143 | - if (!array_key_exists($name, $data)) { |
|
143 | + if ( ! array_key_exists($name, $data)) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | - if (!$metadata->type) { |
|
147 | + if ( ! $metadata->type) { |
|
148 | 148 | throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name)); |
149 | 149 | } |
150 | 150 |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | { |
56 | 56 | $groups = $this->getGroupsFor($navigatorContext); |
57 | 57 | |
58 | - if (!$property->groups) { |
|
59 | - return !in_array(self::DEFAULT_GROUP, $groups); |
|
58 | + if ( ! $property->groups) { |
|
59 | + return ! in_array(self::DEFAULT_GROUP, $groups); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this->shouldSkipUsingGroups($property, $groups); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $groups = $this->groups; |
81 | 81 | foreach ($paths as $index => $path) { |
82 | - if (!array_key_exists($path, $groups)) { |
|
82 | + if ( ! array_key_exists($path, $groups)) { |
|
83 | 83 | if ($index > 0) { |
84 | 84 | $groups = array(self::DEFAULT_GROUP); |
85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | break; |
88 | 88 | } |
89 | 89 | |
90 | - if (!is_array($groups[$path])) { |
|
90 | + if ( ! is_array($groups[$path])) { |
|
91 | 91 | throw new RuntimeException(sprintf('The group value for the property path "%s" should be an array, "%s" given', $index, gettype($groups[$path]))); |
92 | 92 | } |
93 | 93 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version'])); |
90 | 90 | } |
91 | 91 | |
92 | - if (!empty($this->attributes['max_depth_checks'])) { |
|
92 | + if ( ! empty($this->attributes['max_depth_checks'])) { |
|
93 | 93 | $this->addExclusionStrategy(new DepthExclusionStrategy()); |
94 | 94 | } |
95 | 95 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | private function assertMutable(): void |
138 | 138 | { |
139 | - if (!$this->initialized) { |
|
139 | + if ( ! $this->initialized) { |
|
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | throw new LogicException('The groups must not be empty.'); |
169 | 169 | } |
170 | 170 | |
171 | - $this->attributes['groups'] = (array)$groups; |
|
171 | + $this->attributes['groups'] = (array) $groups; |
|
172 | 172 | |
173 | 173 | return $this; |
174 | 174 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | { |
226 | 226 | $metadata = $this->metadataStack->pop(); |
227 | 227 | |
228 | - if (!$metadata instanceof PropertyMetadata) { |
|
228 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
229 | 229 | throw new RuntimeException('Context metadataStack not working well'); |
230 | 230 | } |
231 | 231 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | { |
235 | 235 | $metadata = $this->metadataStack->pop(); |
236 | 236 | |
237 | - if (!$metadata instanceof ClassMetadata) { |
|
237 | + if ( ! $metadata instanceof ClassMetadata) { |
|
238 | 238 | throw new RuntimeException('Context metadataStack not working well'); |
239 | 239 | } |
240 | 240 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function getCurrentPath() |
251 | 251 | { |
252 | - if (!$this->metadataStack) { |
|
252 | + if ( ! $this->metadataStack) { |
|
253 | 253 | return array(); |
254 | 254 | } |
255 | 255 |
@@ -68,8 +68,7 @@ |
||
68 | 68 | AccessorStrategyInterface $accessor, |
69 | 69 | EventDispatcherInterface $dispatcher = null, |
70 | 70 | ExpressionEvaluatorInterface $expressionEvaluator = null |
71 | - ) |
|
72 | - { |
|
71 | + ) { |
|
73 | 72 | $this->dispatcher = $dispatcher ?: new EventDispatcher(); |
74 | 73 | $this->metadataFactory = $metadataFactory; |
75 | 74 | $this->handlerRegistry = $handlerRegistry; |
@@ -130,33 +130,33 @@ |
||
130 | 130 | |
131 | 131 | switch ($type['name']) { |
132 | 132 | case 'NULL': |
133 | - if (!$this->shouldSerializeNull) { |
|
133 | + if ( ! $this->shouldSerializeNull) { |
|
134 | 134 | throw new NotAcceptableException(); |
135 | 135 | } |
136 | 136 | return $this->visitor->visitNull($data, $type); |
137 | 137 | |
138 | 138 | case 'string': |
139 | - return $this->visitor->visitString((string)$data, $type); |
|
139 | + return $this->visitor->visitString((string) $data, $type); |
|
140 | 140 | |
141 | 141 | case 'int': |
142 | 142 | case 'integer': |
143 | - return $this->visitor->visitInteger((int)$data, $type); |
|
143 | + return $this->visitor->visitInteger((int) $data, $type); |
|
144 | 144 | |
145 | 145 | case 'bool': |
146 | 146 | case 'boolean': |
147 | - return $this->visitor->visitBoolean((bool)$data, $type); |
|
147 | + return $this->visitor->visitBoolean((bool) $data, $type); |
|
148 | 148 | |
149 | 149 | case 'double': |
150 | 150 | case 'float': |
151 | - return $this->visitor->visitDouble((float)$data, $type); |
|
151 | + return $this->visitor->visitDouble((float) $data, $type); |
|
152 | 152 | |
153 | 153 | case 'array': |
154 | - return $this->visitor->visitArray((array)$data, $type); |
|
154 | + return $this->visitor->visitArray((array) $data, $type); |
|
155 | 155 | |
156 | 156 | case 'resource': |
157 | 157 | $msg = 'Resources are not supported in serialized data.'; |
158 | 158 | if (null !== $path = $this->context->getPath()) { |
159 | - $msg .= ' Path: ' . $path; |
|
159 | + $msg .= ' Path: '.$path; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | throw new RuntimeException($msg); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public static function getDefaultMethodName($eventName) |
39 | 39 | { |
40 | - return 'on' . str_replace(array('_', '.'), '', $eventName); |
|
40 | + return 'on'.str_replace(array('_', '.'), '', $eventName); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function addSubscriber(EventSubscriberInterface $subscriber) |
61 | 61 | { |
62 | 62 | foreach ($subscriber->getSubscribedEvents() as $eventData) { |
63 | - if (!isset($eventData['event'])) { |
|
63 | + if ( ! isset($eventData['event'])) { |
|
64 | 64 | throw new InvalidArgumentException(sprintf('Each event must have a "event" key.')); |
65 | 65 | } |
66 | 66 | |
@@ -75,30 +75,30 @@ discard block |
||
75 | 75 | |
76 | 76 | public function hasListeners($eventName, $class, $format) |
77 | 77 | { |
78 | - if (!isset($this->listeners[$eventName])) { |
|
78 | + if ( ! isset($this->listeners[$eventName])) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | |
82 | - if (!isset($this->classListeners[$eventName][$class][$format])) { |
|
82 | + if ( ! isset($this->classListeners[$eventName][$class][$format])) { |
|
83 | 83 | $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format); |
84 | 84 | } |
85 | 85 | |
86 | - return !!$this->classListeners[$eventName][$class][$format]; |
|
86 | + return ! ! $this->classListeners[$eventName][$class][$format]; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function dispatch($eventName, $class, $format, Event $event) |
90 | 90 | { |
91 | - if (!isset($this->listeners[$eventName])) { |
|
91 | + if ( ! isset($this->listeners[$eventName])) { |
|
92 | 92 | return; |
93 | 93 | } |
94 | 94 | |
95 | 95 | $object = $event instanceof ObjectEvent ? $event->getObject() : null; |
96 | - $objectClass = $object ? (get_class($object) . $class) : $class; |
|
96 | + $objectClass = $object ? (get_class($object).$class) : $class; |
|
97 | 97 | |
98 | - if (!isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
98 | + if ( ! isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
99 | 99 | $this->classListeners[$eventName][$objectClass][$format] = array(); |
100 | 100 | foreach ($this->initializeListeners($eventName, $class, $format) as $listener) { |
101 | - if ($listener[3] !== null && !($object instanceof $listener[3])) { |
|
101 | + if ($listener[3] !== null && ! ($object instanceof $listener[3])) { |
|
102 | 102 | continue; |
103 | 103 | } |
104 | 104 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public function __construct($container) |
32 | 32 | { |
33 | - if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) { |
|
33 | + if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) { |
|
34 | 34 | throw new InvalidArgumentException(sprintf('The container must be an instance of %s or %s (%s given).', PsrContainerInterface::class, ContainerInterface::class, \is_object($container) ? \get_class($container) : \gettype($container))); |
35 | 35 | } |
36 | 36 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | $listeners = parent::initializeListeners($eventName, $loweredClass, $format); |
46 | 46 | |
47 | 47 | foreach ($listeners as &$listener) { |
48 | - if (!\is_array($listener[0]) || !\is_string($listener[0][0])) { |
|
48 | + if ( ! \is_array($listener[0]) || ! \is_string($listener[0][0])) { |
|
49 | 49 | continue; |
50 | 50 | } |
51 | 51 | |
52 | - if (!$this->container->has($listener[0][0])) { |
|
52 | + if ( ! $this->container->has($listener[0][0])) { |
|
53 | 53 | continue; |
54 | 54 | } |
55 | 55 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | public function createRoot(ClassMetadata $metadata = null, $rootName = null, $rootNamespace = null) |
80 | 80 | { |
81 | - if ($metadata !== null && !empty($metadata->xmlRootName)) { |
|
81 | + if ($metadata !== null && ! empty($metadata->xmlRootName)) { |
|
82 | 82 | $rootName = $metadata->xmlRootName; |
83 | 83 | $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata); |
84 | 84 | } else { |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | { |
112 | 112 | $doCData = null !== $this->currentMetadata ? $this->currentMetadata->xmlElementCData : true; |
113 | 113 | |
114 | - return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
|
114 | + return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | public function visitSimpleString($data, array $type) |
118 | 118 | { |
119 | - return $this->document->createTextNode((string)$data); |
|
119 | + return $this->document->createTextNode((string) $data); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | public function visitBoolean(bool $data, array $type) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | public function visitInteger(int $data, array $type) |
128 | 128 | { |
129 | - return $this->document->createTextNode((string)$data); |
|
129 | + return $this->document->createTextNode((string) $data); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function visitDouble(float $data, array $type) |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | if (floor($data) === $data) { |
135 | 135 | return $this->document->createTextNode($data.".0"); |
136 | 136 | } else { |
137 | - return $this->document->createTextNode((string)$data); |
|
137 | + return $this->document->createTextNode((string) $data); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | $elType = $this->getElementType($type); |
152 | 152 | foreach ($data as $k => $v) { |
153 | 153 | |
154 | - $tagName = (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs && $this->isElementNameValid((string)$k)) ? $k : $entryName; |
|
154 | + $tagName = (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs && $this->isElementNameValid((string) $k)) ? $k : $entryName; |
|
155 | 155 | |
156 | 156 | $entryNode = $this->createElement($tagName, $namespace); |
157 | 157 | $this->currentNode->appendChild($entryNode); |
158 | 158 | $this->setCurrentNode($entryNode); |
159 | 159 | |
160 | 160 | if (null !== $keyAttributeName) { |
161 | - $entryNode->setAttribute($keyAttributeName, (string)$k); |
|
161 | + $entryNode->setAttribute($keyAttributeName, (string) $k); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | try { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $node = $this->navigator->accept($v, $metadata->type); |
194 | 194 | $this->revertCurrentMetadata(); |
195 | 195 | |
196 | - if (!$node instanceof \DOMCharacterData) { |
|
196 | + if ( ! $node instanceof \DOMCharacterData) { |
|
197 | 197 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
198 | 198 | } |
199 | 199 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
206 | - || (!$metadata->xmlValue && $this->hasValue) |
|
206 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
207 | 207 | ) { |
208 | 208 | 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)); |
209 | 209 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $node = $this->navigator->accept($v, $metadata->type); |
216 | 216 | $this->revertCurrentMetadata(); |
217 | 217 | |
218 | - if (!$node instanceof \DOMCharacterData) { |
|
218 | + if ( ! $node instanceof \DOMCharacterData) { |
|
219 | 219 | 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))); |
220 | 220 | } |
221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | if ($metadata->xmlAttributeMap) { |
228 | - if (!\is_array($v)) { |
|
228 | + if ( ! \is_array($v)) { |
|
229 | 229 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v))); |
230 | 230 | } |
231 | 231 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $node = $this->navigator->accept($value, null); |
235 | 235 | $this->revertCurrentMetadata(); |
236 | 236 | |
237 | - if (!$node instanceof \DOMCharacterData) { |
|
237 | + if ( ! $node instanceof \DOMCharacterData) { |
|
238 | 238 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
239 | 239 | } |
240 | 240 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | return; |
245 | 245 | } |
246 | 246 | |
247 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
247 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
248 | 248 | |
249 | 249 | $namespace = null !== $metadata->xmlNamespace |
250 | 250 | ? $metadata->xmlNamespace |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | private function isSkippableEmptyObject($node, PropertyMetadata $metadata) |
296 | 296 | { |
297 | - return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
297 | + return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | private function isSkippableCollection(PropertyMetadata $metadata) |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | private function isElementEmpty(\DOMElement $element) |
306 | 306 | { |
307 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
307 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | public function endVisitingObject(ClassMetadata $metadata, object $data, array $type) |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
412 | 412 | $attribute = 'xmlns'; |
413 | 413 | if ($prefix !== '') { |
414 | - $attribute .= ':' . $prefix; |
|
414 | + $attribute .= ':'.$prefix; |
|
415 | 415 | } elseif ($element->namespaceURI === $uri) { |
416 | 416 | continue; |
417 | 417 | } |
@@ -427,19 +427,19 @@ discard block |
||
427 | 427 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
428 | 428 | return $this->document->createElementNS($namespace, $tagName); |
429 | 429 | } |
430 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
431 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
430 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
431 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
432 | 432 | } |
433 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
433 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
437 | 437 | { |
438 | 438 | if (null !== $namespace) { |
439 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
440 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
439 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
440 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
441 | 441 | } |
442 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
442 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
443 | 443 | } else { |
444 | 444 | $node->setAttribute($name, $value); |
445 | 445 | } |