@@ -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 = []; |
77 | 77 | $propertiesNodes = []; |
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 = []; |
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 = []; |
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,44 +183,44 @@ 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 | - $pMetadata->groups = (array)$pElem->groups->value; |
|
223 | + $pMetadata->groups = (array) $pElem->groups->value; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | if (isset($pElem->{'xml-list'})) { |
@@ -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 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function translateName(PropertyMetadata $property): string |
45 | 45 | { |
46 | - $name = preg_replace('/[A-Z]+/', $this->separator . '\\0', $property->name); |
|
46 | + $name = preg_replace('/[A-Z]+/', $this->separator.'\\0', $property->name); |
|
47 | 47 | |
48 | 48 | if ($this->lowerCase) { |
49 | 49 | return strtolower($name); |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | /** @var $metadata ClassMetadata */ |
164 | 164 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
165 | 165 | |
166 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
166 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
167 | 167 | throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language."); |
168 | 168 | } |
169 | 169 | |
170 | - if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
170 | + if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
171 | 171 | $metadata = $this->resolveMetadata($data, $metadata); |
172 | 172 | } |
173 | 173 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata); |
218 | 218 | |
219 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
219 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
220 | 220 | throw new LogicException(sprintf( |
221 | 221 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
222 | 222 | $typeValue, |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | |
38 | 38 | switch ($direction) { |
39 | 39 | case GraphNavigatorInterface::DIRECTION_DESERIALIZATION: |
40 | - return 'deserialize' . $type . 'From' . $format; |
|
40 | + return 'deserialize'.$type.'From'.$format; |
|
41 | 41 | |
42 | 42 | case GraphNavigatorInterface::DIRECTION_SERIALIZATION: |
43 | - return 'serialize' . $type . 'To' . $format; |
|
43 | + return 'serialize'.$type.'To'.$format; |
|
44 | 44 | |
45 | 45 | default: |
46 | 46 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigatorInterface::DIRECTION_??? constants.', json_encode($direction))); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler): void |
56 | 56 | { |
57 | 57 | foreach ($handler->getSubscribingMethods() as $methodData) { |
58 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
58 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
59 | 59 | throw new RuntimeException(sprintf('For each subscribing method a "type" and "format" attribute must be given, but only got "%s" for %s.', implode('" and "', array_keys($methodData)), \get_class($handler))); |
60 | 60 | } |
61 | 61 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | public function getHandler(int $direction, string $typeName, string $format) |
84 | 84 | { |
85 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
85 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
86 | 86 | return null; |
87 | 87 | } |
88 | 88 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'type' => $type, |
56 | 56 | 'format' => $format, |
57 | 57 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
58 | - 'method' => 'serialize' . $type, |
|
58 | + 'method' => 'serialize'.$type, |
|
59 | 59 | ]; |
60 | 60 | } |
61 | 61 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | $format = $this->getFormat($type); |
84 | 84 | if ('U' === $format) { |
85 | - return $visitor->visitInteger((int)$date->format($format), $type); |
|
85 | + return $visitor->visitInteger((int) $date->format($format), $type); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | return $visitor->visitString($date->format($this->getFormat($type)), $type); |
@@ -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) |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return null; |
144 | 144 | } |
145 | 145 | |
146 | - return $this->parseDateInterval((string)$data); |
|
146 | + return $this->parseDateInterval((string) $data); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | public function deserializeDateTimeFromJson(JsonDeserializationVisitor $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) { |
@@ -240,15 +240,15 @@ discard block |
||
240 | 240 | $format = 'P'; |
241 | 241 | |
242 | 242 | if (0 < $dateInterval->y) { |
243 | - $format .= $dateInterval->y . 'Y'; |
|
243 | + $format .= $dateInterval->y.'Y'; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | if (0 < $dateInterval->m) { |
247 | - $format .= $dateInterval->m . 'M'; |
|
247 | + $format .= $dateInterval->m.'M'; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | if (0 < $dateInterval->d) { |
251 | - $format .= $dateInterval->d . 'D'; |
|
251 | + $format .= $dateInterval->d.'D'; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -256,15 +256,15 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | if (0 < $dateInterval->h) { |
259 | - $format .= $dateInterval->h . 'H'; |
|
259 | + $format .= $dateInterval->h.'H'; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | if (0 < $dateInterval->i) { |
263 | - $format .= $dateInterval->i . 'M'; |
|
263 | + $format .= $dateInterval->i.'M'; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | if (0 < $dateInterval->s) { |
267 | - $format .= $dateInterval->s . 'S'; |
|
267 | + $format .= $dateInterval->s.'S'; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | if ($format === 'P') { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function createRoot(ClassMetadata $metadata = null, $rootName = null, $rootNamespace = null) |
81 | 81 | { |
82 | - if ($metadata !== null && !empty($metadata->xmlRootName)) { |
|
82 | + if ($metadata !== null && ! empty($metadata->xmlRootName)) { |
|
83 | 83 | $rootName = $metadata->xmlRootName; |
84 | 84 | $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata); |
85 | 85 | } else { |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | { |
113 | 113 | $doCData = null !== $this->currentMetadata ? $this->currentMetadata->xmlElementCData : true; |
114 | 114 | |
115 | - return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
|
115 | + return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | public function visitSimpleString($data, array $type) |
119 | 119 | { |
120 | - return $this->document->createTextNode((string)$data); |
|
120 | + return $this->document->createTextNode((string) $data); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | public function visitBoolean(bool $data, array $type) |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | |
128 | 128 | public function visitInteger(int $data, array $type) |
129 | 129 | { |
130 | - return $this->document->createTextNode((string)$data); |
|
130 | + return $this->document->createTextNode((string) $data); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function visitDouble(float $data, array $type) |
134 | 134 | { |
135 | 135 | if (floor($data) === $data) { |
136 | - return $this->document->createTextNode($data . ".0"); |
|
136 | + return $this->document->createTextNode($data.".0"); |
|
137 | 137 | } else { |
138 | - return $this->document->createTextNode((string)$data); |
|
138 | + return $this->document->createTextNode((string) $data); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | $elType = $this->getElementType($type); |
153 | 153 | foreach ($data as $k => $v) { |
154 | 154 | |
155 | - $tagName = (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs && $this->isElementNameValid((string)$k)) ? $k : $entryName; |
|
155 | + $tagName = (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs && $this->isElementNameValid((string) $k)) ? $k : $entryName; |
|
156 | 156 | |
157 | 157 | $entryNode = $this->createElement($tagName, $namespace); |
158 | 158 | $this->currentNode->appendChild($entryNode); |
159 | 159 | $this->setCurrentNode($entryNode); |
160 | 160 | |
161 | 161 | if (null !== $keyAttributeName) { |
162 | - $entryNode->setAttribute($keyAttributeName, (string)$k); |
|
162 | + $entryNode->setAttribute($keyAttributeName, (string) $k); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | try { |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $node = $this->navigator->accept($v, $metadata->type); |
195 | 195 | $this->revertCurrentMetadata(); |
196 | 196 | |
197 | - if (!$node instanceof \DOMCharacterData) { |
|
197 | + if ( ! $node instanceof \DOMCharacterData) { |
|
198 | 198 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
199 | 199 | } |
200 | 200 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
207 | - || (!$metadata->xmlValue && $this->hasValue) |
|
207 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
208 | 208 | ) { |
209 | 209 | 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)); |
210 | 210 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $node = $this->navigator->accept($v, $metadata->type); |
217 | 217 | $this->revertCurrentMetadata(); |
218 | 218 | |
219 | - if (!$node instanceof \DOMCharacterData) { |
|
219 | + if ( ! $node instanceof \DOMCharacterData) { |
|
220 | 220 | 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))); |
221 | 221 | } |
222 | 222 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | if ($metadata->xmlAttributeMap) { |
229 | - if (!\is_array($v)) { |
|
229 | + if ( ! \is_array($v)) { |
|
230 | 230 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v))); |
231 | 231 | } |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $node = $this->navigator->accept($value, null); |
236 | 236 | $this->revertCurrentMetadata(); |
237 | 237 | |
238 | - if (!$node instanceof \DOMCharacterData) { |
|
238 | + if ( ! $node instanceof \DOMCharacterData) { |
|
239 | 239 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
240 | 240 | } |
241 | 241 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | return; |
246 | 246 | } |
247 | 247 | |
248 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
248 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
249 | 249 | |
250 | 250 | $namespace = null !== $metadata->xmlNamespace |
251 | 251 | ? $metadata->xmlNamespace |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | |
291 | 291 | private function isSkippableEmptyObject($node, PropertyMetadata $metadata) |
292 | 292 | { |
293 | - return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
293 | + return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | private function isSkippableCollection(PropertyMetadata $metadata) |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | private function isElementEmpty(\DOMElement $element) |
302 | 302 | { |
303 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
303 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | public function endVisitingObject(ClassMetadata $metadata, object $data, array $type) |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
408 | 408 | $attribute = 'xmlns'; |
409 | 409 | if ($prefix !== '') { |
410 | - $attribute .= ':' . $prefix; |
|
410 | + $attribute .= ':'.$prefix; |
|
411 | 411 | } elseif ($element->namespaceURI === $uri) { |
412 | 412 | continue; |
413 | 413 | } |
@@ -423,19 +423,19 @@ discard block |
||
423 | 423 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
424 | 424 | return $this->document->createElementNS($namespace, $tagName); |
425 | 425 | } |
426 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
427 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
426 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
427 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
428 | 428 | } |
429 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
429 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
433 | 433 | { |
434 | 434 | if (null !== $namespace) { |
435 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
436 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
435 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
436 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
437 | 437 | } |
438 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
438 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
439 | 439 | } else { |
440 | 440 | $node->setAttribute($name, $value); |
441 | 441 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | if (false !== stripos($data, '<!doctype')) { |
62 | 62 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
63 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
63 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
64 | 64 | throw new InvalidArgumentException(sprintf( |
65 | 65 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
66 | 66 | $internalSubset |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | private function emptyStringToSpaceCharacter($data) |
84 | 84 | { |
85 | - return $data === '' ? ' ' : (string)$data; |
|
85 | + return $data === '' ? ' ' : (string) $data; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function visitNull($data, array $type): void |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | |
93 | 93 | public function visitString($data, array $type): string |
94 | 94 | { |
95 | - return (string)$data; |
|
95 | + return (string) $data; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | public function visitBoolean($data, array $type): bool |
99 | 99 | { |
100 | - $data = (string)$data; |
|
100 | + $data = (string) $data; |
|
101 | 101 | |
102 | 102 | if ('true' === $data || '1' === $data) { |
103 | 103 | return true; |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | |
111 | 111 | public function visitInteger($data, array $type): int |
112 | 112 | { |
113 | - return (integer)$data; |
|
113 | + return (integer) $data; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | public function visitDouble($data, array $type): float |
117 | 117 | { |
118 | - return (double)$data; |
|
118 | + return (double) $data; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | public function visitArray($data, array $type): array |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $nodes = $data->xpath($entryName); |
161 | 161 | } |
162 | 162 | |
163 | - if (!\count($nodes)) { |
|
163 | + if ( ! \count($nodes)) { |
|
164 | 164 | return []; |
165 | 165 | } |
166 | 166 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $nodes = $data->children($namespace)->$entryName; |
189 | 189 | foreach ($nodes as $v) { |
190 | 190 | $attrs = $v->attributes(); |
191 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
191 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
192 | 192 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
193 | 193 | } |
194 | 194 | |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | switch (true) { |
209 | 209 | // Check XML attribute without namespace for discriminatorFieldName |
210 | 210 | case $metadata->xmlDiscriminatorAttribute && null === $metadata->xmlDiscriminatorNamespace && isset($data->attributes()->{$metadata->discriminatorFieldName}): |
211 | - return (string)$data->attributes()->{$metadata->discriminatorFieldName}; |
|
211 | + return (string) $data->attributes()->{$metadata->discriminatorFieldName}; |
|
212 | 212 | |
213 | 213 | // Check XML attribute with namespace for discriminatorFieldName |
214 | 214 | case $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
215 | - return (string)$data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
215 | + return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
216 | 216 | |
217 | 217 | // Check XML element with namespace for discriminatorFieldName |
218 | - case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
219 | - return (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
218 | + case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
219 | + return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
220 | 220 | // Check XML element for discriminatorFieldName |
221 | 221 | case isset($data->{$metadata->discriminatorFieldName}): |
222 | - return (string)$data->{$metadata->discriminatorFieldName}; |
|
222 | + return (string) $data->{$metadata->discriminatorFieldName}; |
|
223 | 223 | |
224 | 224 | default: |
225 | 225 | throw new LogicException(sprintf( |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | $name = $metadata->serializedName; |
242 | 242 | |
243 | - if (!$metadata->type) { |
|
243 | + if ( ! $metadata->type) { |
|
244 | 244 | throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name)); |
245 | 245 | } |
246 | 246 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | if ($metadata->xmlCollection) { |
262 | 262 | $enclosingElem = $data; |
263 | - if (!$metadata->xmlCollectionInline) { |
|
263 | + if ( ! $metadata->xmlCollectionInline) { |
|
264 | 264 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
265 | 265 | } |
266 | 266 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | if ($metadata->xmlNamespace) { |
274 | 274 | $node = $data->children($metadata->xmlNamespace)->$name; |
275 | - if (!$node->count()) { |
|
275 | + if ( ! $node->count()) { |
|
276 | 276 | throw new NotAcceptableException(); |
277 | 277 | } |
278 | 278 | } else { |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | if (isset($namespaces[''])) { |
283 | 283 | $prefix = uniqid('ns-'); |
284 | 284 | $data->registerXPathNamespace($prefix, $namespaces['']); |
285 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
285 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
286 | 286 | } else { |
287 | - $nodes = $data->xpath('./' . $name); |
|
287 | + $nodes = $data->xpath('./'.$name); |
|
288 | 288 | } |
289 | 289 | if (empty($nodes)) { |
290 | 290 | throw new NotAcceptableException(); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | $xsiAttributes = $value->attributes('http://www.w3.org/2001/XMLSchema-instance'); |
399 | 399 | if (isset($xsiAttributes['nil']) |
400 | - && ((string)$xsiAttributes['nil'] === 'true' || (string)$xsiAttributes['nil'] === '1') |
|
400 | + && ((string) $xsiAttributes['nil'] === 'true' || (string) $xsiAttributes['nil'] === '1') |
|
401 | 401 | ) { |
402 | 402 | return true; |
403 | 403 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function startVisiting($object): void |
56 | 56 | { |
57 | - if (!\is_object($object)) { |
|
57 | + if ( ! \is_object($object)) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | $this->visitingSet->attach($object); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | public function stopVisiting($object): void |
65 | 65 | { |
66 | - if (!\is_object($object)) { |
|
66 | + if ( ! \is_object($object)) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | $this->visitingSet->detach($object); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | public function isVisiting($object): bool |
78 | 78 | { |
79 | - if (!\is_object($object)) { |
|
79 | + if ( ! \is_object($object)) { |
|
80 | 80 | return false; |
81 | 81 | } |
82 | 82 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $path[] = \get_class($obj); |
91 | 91 | } |
92 | 92 | |
93 | - if (!$path) { |
|
93 | + if ( ! $path) { |
|
94 | 94 | return null; |
95 | 95 | } |
96 | 96 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | public function getObject(): ?object |
111 | 111 | { |
112 | - return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
112 | + return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public function getVisitingStack() |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public static function getDefaultMethodName($eventName) |
39 | 39 | { |
40 | - return 'on' . str_replace(['_', '.'], '', $eventName); |
|
40 | + return 'on'.str_replace(['_', '.'], '', $eventName); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function addSubscriber(EventSubscriberInterface $subscriber): void |
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,34 +75,34 @@ discard block |
||
75 | 75 | |
76 | 76 | public function hasListeners(string $eventName, string $class, string $format): bool |
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, string $class, string $format, Event $event): void |
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 | 96 | $realClass = is_object($object) ? get_class($object) : ''; |
97 | - $objectClass = $realClass !== $class ? ($realClass . $class) : $class; |
|
97 | + $objectClass = $realClass !== $class ? ($realClass.$class) : $class; |
|
98 | 98 | |
99 | - if (!isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
99 | + if ( ! isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
100 | 100 | $this->classListeners[$eventName][$objectClass][$format] = $this->initializeListeners($eventName, $class, $format); |
101 | 101 | } |
102 | 102 | |
103 | 103 | foreach ($this->classListeners[$eventName][$objectClass][$format] as $listener) { |
104 | 104 | |
105 | - if ($listener[3] !== null && !($object instanceof $listener[3])) { |
|
105 | + if ($listener[3] !== null && ! ($object instanceof $listener[3])) { |
|
106 | 106 | continue; |
107 | 107 | } |
108 | 108 |