Completed
Push — master ( 2b1686...37cc39 )
by Johannes
11s
created
src/JMS/Serializer/XmlSerializationVisitor.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -44,6 +44,9 @@  discard block
 block discarded – undo
44 44
     private $nullWasVisited;
45 45
     private $objectMetadataStack;
46 46
 
47
+    /**
48
+     * @param Naming\PropertyNamingStrategyInterface $namingStrategy
49
+     */
47 50
     public function __construct($namingStrategy)
48 51
     {
49 52
         parent::__construct($namingStrategy);
@@ -437,6 +440,9 @@  discard block
 block discarded – undo
437 440
         }
438 441
     }
439 442
 
443
+    /**
444
+     * @return \DOMNode
445
+     */
440 446
     private function createElement($tagName, $namespace = null)
441 447
     {
442 448
         if (null !== $namespace) {
@@ -456,6 +462,9 @@  discard block
 block discarded – undo
456 462
         }
457 463
     }
458 464
 
465
+    /**
466
+     * @param string $value
467
+     */
459 468
     private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null)
460 469
     {
461 470
         if (null !== $namespace) {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             $this->document = $this->createDocument(null, null, false);
198 198
             if ($metadata->xmlRootName) {
199 199
                 $rootName = $metadata->xmlRootName;
200
-                $rootNamespace = $metadata->xmlRootNamespace?:$this->getClassDefaultNamespace($metadata);
200
+                $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata);
201 201
             } else {
202 202
                 $rootName = $this->defaultRootName;
203 203
                 $rootNamespace = $this->defaultRootNamespace;
@@ -444,10 +444,10 @@  discard block
 block discarded – undo
444 444
             if ($this->currentNode->isDefaultNamespace($namespace)) {
445 445
                 return $this->document->createElementNS($namespace, $tagName);
446 446
             } else {
447
-                if (!$prefix = $this->currentNode->lookupPrefix($namespace)) {
448
-                    $prefix = 'ns-'.  substr(sha1($namespace), 0, 8);
447
+                if ( ! $prefix = $this->currentNode->lookupPrefix($namespace)) {
448
+                    $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
449 449
                 }
450
-                return $this->document->createElementNS($namespace, $prefix . ':' . $tagName);
450
+                return $this->document->createElementNS($namespace, $prefix.':'.$tagName);
451 451
             }
452 452
 
453 453
 
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
     private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null)
460 460
     {
461 461
         if (null !== $namespace) {
462
-            if (!$prefix = $node->lookupPrefix($namespace)) {
463
-                $prefix = 'ns-'.  substr(sha1($namespace), 0, 8);
462
+            if ( ! $prefix = $node->lookupPrefix($namespace)) {
463
+                $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
464 464
             }
465 465
             $node->setAttributeNS($namespace, $prefix.':'.$name, $value);
466 466
         } else {
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
     private function getClassDefaultNamespace(ClassMetadata $metadata)
472 472
     {
473
-        return (isset($metadata->xmlNamespaces[''])?$metadata->xmlNamespaces['']:null);
473
+        return (isset($metadata->xmlNamespaces['']) ? $metadata->xmlNamespaces[''] : null);
474 474
     }
475 475
 
476 476
 }
Please login to merge, or discard this patch.
src/JMS/Serializer/XmlDeserializationVisitor.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@
 block discarded – undo
226 226
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name));
227 227
         }
228 228
 
229
-       if ($metadata->xmlAttribute) {
229
+        if ($metadata->xmlAttribute) {
230 230
 
231 231
             $attributes = $data->attributes($metadata->xmlNamespace);
232 232
             if (isset($attributes[$name])) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 
152 152
         if ($namespace === null && $this->objectMetadataStack->count()) {
153 153
             $classMetadata = $this->objectMetadataStack->top();
154
-            $namespace = isset($classMetadata->xmlNamespaces[''])?$classMetadata->xmlNamespaces['']:$namespace;
154
+            $namespace = isset($classMetadata->xmlNamespaces['']) ? $classMetadata->xmlNamespaces[''] : $namespace;
155 155
         }
156 156
 
157
-        if ( ! isset($data->$entryName) ) {
157
+        if ( ! isset($data->$entryName)) {
158 158
             if (null === $this->result) {
159 159
                 return $this->result = array();
160 160
             }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
         if ($metadata->xmlCollection) {
248 248
             $enclosingElem = $data;
249
-            if (!$metadata->xmlCollectionInline) {
249
+            if ( ! $metadata->xmlCollectionInline) {
250 250
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
251 251
             }
252 252
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
         if ($metadata->xmlNamespace) {
262 262
             $node = $data->children($metadata->xmlNamespace)->$name;
263
-            if (!$node->count()) {
263
+            if ( ! $node->count()) {
264 264
                 return;
265 265
             }
266 266
         } else {
@@ -270,13 +270,13 @@  discard block
 block discarded – undo
270 270
             if (isset($namespaces[''])) {
271 271
                 $prefix = uniqid('ns-');
272 272
                 $data->registerXPathNamespace($prefix, $namespaces['']);
273
-                $nodes = $data->xpath('./'.$prefix. ':'.$name );
273
+                $nodes = $data->xpath('./'.$prefix.':'.$name);
274 274
                 if (empty($nodes)) {
275 275
                     return;
276 276
                 }
277 277
                 $node = reset($nodes);
278 278
             } else {
279
-                if (!isset($data->$name)) {
279
+                if ( ! isset($data->$name)) {
280 280
                     return;
281 281
                 }
282 282
                 $node = $data->$name;
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/PropertyMetadata.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
             $parentStr
156 156
         ) = $unserialized;
157 157
 
158
-        if (isset($unserialized['xmlEntryNamespace'])){
158
+        if (isset($unserialized['xmlEntryNamespace'])) {
159 159
             $this->xmlEntryNamespace = $unserialized['xmlEntryNamespace'];
160 160
         }
161 161
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
             $parentStr
156 156
         ) = $unserialized;
157 157
 
158
-        if (isset($unserialized['xmlEntryNamespace'])){
158
+        if (isset($unserialized['xmlEntryNamespace'])) {
159 159
             $this->xmlEntryNamespace = $unserialized['xmlEntryNamespace'];
160 160
         }
161 161
 
Please login to merge, or discard this patch.