Passed
Push — master ( 85428b...881489 )
by Asmir
05:57 queued 02:54
created
src/XmlDeserializationVisitor.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
         if (false !== stripos($data, '<!doctype')) {
46 46
             $internalSubset = $this->getDomDocumentTypeEntitySubset($data);
47
-            if (!in_array($internalSubset, $this->doctypeWhitelist, true)) {
47
+            if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) {
48 48
                 throw new InvalidArgumentException(sprintf(
49 49
                     'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
50 50
                     $internalSubset
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     private function emptyStringToSpaceCharacter($data)
68 68
     {
69
-        return $data === '' ? ' ' : (string)$data;
69
+        return $data === '' ? ' ' : (string) $data;
70 70
     }
71 71
 
72 72
     public function visitNull($data, array $type): void
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 
77 77
     public function visitString($data, array $type): string
78 78
     {
79
-        return (string)$data;
79
+        return (string) $data;
80 80
     }
81 81
 
82 82
     public function visitBoolean($data, array $type): bool
83 83
     {
84
-        $data = (string)$data;
84
+        $data = (string) $data;
85 85
 
86 86
         if ('true' === $data || '1' === $data) {
87 87
             return true;
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 
95 95
     public function visitInteger($data, array $type): int
96 96
     {
97
-        return (integer)$data;
97
+        return (integer) $data;
98 98
     }
99 99
 
100 100
     public function visitDouble($data, array $type): float
101 101
     {
102
-        return (double)$data;
102
+        return (double) $data;
103 103
     }
104 104
 
105 105
     public function visitArray($data, array $type): array
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             $nodes = $data->xpath($entryName);
145 145
         }
146 146
 
147
-        if (!\count($nodes)) {
147
+        if ( ! \count($nodes)) {
148 148
             return [];
149 149
         }
150 150
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                 $nodes = $data->children($namespace)->$entryName;
173 173
                 foreach ($nodes as $v) {
174 174
                     $attrs = $v->attributes();
175
-                    if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
175
+                    if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
176 176
                         throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute));
177 177
                     }
178 178
 
@@ -192,18 +192,18 @@  discard block
 block discarded – undo
192 192
         switch (true) {
193 193
             // Check XML attribute without namespace for discriminatorFieldName
194 194
             case $metadata->xmlDiscriminatorAttribute && null === $metadata->xmlDiscriminatorNamespace && isset($data->attributes()->{$metadata->discriminatorFieldName}):
195
-                return (string)$data->attributes()->{$metadata->discriminatorFieldName};
195
+                return (string) $data->attributes()->{$metadata->discriminatorFieldName};
196 196
 
197 197
             // Check XML attribute with namespace for discriminatorFieldName
198 198
             case $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
199
-                return (string)$data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
199
+                return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
200 200
 
201 201
             // Check XML element with namespace for discriminatorFieldName
202
-            case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
203
-                return (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
202
+            case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
203
+                return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
204 204
             // Check XML element for discriminatorFieldName
205 205
             case isset($data->{$metadata->discriminatorFieldName}):
206
-                return (string)$data->{$metadata->discriminatorFieldName};
206
+                return (string) $data->{$metadata->discriminatorFieldName};
207 207
 
208 208
             default:
209 209
                 throw new LogicException(sprintf(
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     {
225 225
         $name = $metadata->serializedName;
226 226
 
227
-        if (!$metadata->type) {
227
+        if ( ! $metadata->type) {
228 228
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->class, $metadata->name));
229 229
         }
230 230
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
         if ($metadata->xmlCollection) {
246 246
             $enclosingElem = $data;
247
-            if (!$metadata->xmlCollectionInline) {
247
+            if ( ! $metadata->xmlCollectionInline) {
248 248
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
249 249
             }
250 250
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
         if ($metadata->xmlNamespace) {
258 258
             $node = $data->children($metadata->xmlNamespace)->$name;
259
-            if (!$node->count()) {
259
+            if ( ! $node->count()) {
260 260
                 throw new NotAcceptableException();
261 261
             }
262 262
         } else {
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
             if (isset($namespaces[''])) {
267 267
                 $prefix = uniqid('ns-');
268 268
                 $data->registerXPathNamespace($prefix, $namespaces['']);
269
-                $nodes = $data->xpath('./' . $prefix . ':' . $name);
269
+                $nodes = $data->xpath('./'.$prefix.':'.$name);
270 270
             } else {
271
-                $nodes = $data->xpath('./' . $name);
271
+                $nodes = $data->xpath('./'.$name);
272 272
             }
273 273
             if (empty($nodes)) {
274 274
                 throw new NotAcceptableException();
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
             $xsiAttributes = $value->attributes('http://www.w3.org/2001/XMLSchema-instance');
383 383
             if (isset($xsiAttributes['nil'])
384
-                && ((string)$xsiAttributes['nil'] === 'true' || (string)$xsiAttributes['nil'] === '1')
384
+                && ((string) $xsiAttributes['nil'] === 'true' || (string) $xsiAttributes['nil'] === '1')
385 385
             ) {
386 386
                 return true;
387 387
             }
Please login to merge, or discard this patch.