Completed
Pull Request — master (#745)
by Joseph
04:46
created
src/JMS/Serializer/Metadata/ExpressionPropertyMetadata.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,10 +115,10 @@
 block discarded – undo
115 115
             $this->name
116 116
         ) = $unserialized;
117 117
 
118
-        if (isset($unserialized['excludeIf'])){
118
+        if (isset($unserialized['excludeIf'])) {
119 119
             $this->excludeIf = $unserialized['excludeIf'];
120 120
         }
121
-        if (isset($unserialized['expression'])){
121
+        if (isset($unserialized['expression'])) {
122 122
             $this->expression = $unserialized['expression'];
123 123
         }
124 124
     }
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/Driver/XmlDriver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         foreach ($elem->xpath('./virtual-property') as $method) {
118 118
 
119 119
             if (isset($method->attributes()->expression)) {
120
-                $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string)$method->attributes()->name, (string)$method->attributes()->expression);
120
+                $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string) $method->attributes()->name, (string) $method->attributes()->expression);
121 121
             } else {
122 122
                 if ( ! isset($method->attributes()->method)) {
123 123
                     throw new RuntimeException('The method attribute must be set for all virtual-property elements.');
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
                     }
160 160
 
161 161
                     if (null !== $excludeIf = $pElem->attributes()->{'exclude-if'}) {
162
-                        $pMetadata->excludeIf =$excludeIf;
162
+                        $pMetadata->excludeIf = $excludeIf;
163 163
                     }
164 164
 
165 165
                     if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) {
166
-                        $pMetadata->excludeIf = "!(" . $excludeIf .")";
166
+                        $pMetadata->excludeIf = "!(".$excludeIf.")";
167 167
                         $isExpose = true;
168 168
                     }
169 169
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/Driver/YamlDriver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         if (array_key_exists('virtual_properties', $config)) {
54 54
             foreach ($config['virtual_properties'] as $methodName => $propertySettings) {
55 55
                 if (isset($propertySettings['exp'])) {
56
-                    $virtualPropertyMetadata = new ExpressionPropertyMetadata( $name, $methodName, $propertySettings['exp']);
56
+                    $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $methodName, $propertySettings['exp']);
57 57
                     unset($propertySettings['exp']);
58 58
 
59 59
                 } else {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     }
108 108
 
109 109
                     if (isset($pConfig['expose_if'])) {
110
-                        $pMetadata->excludeIf = "!(" . $pConfig['expose_if'].")";
110
+                        $pMetadata->excludeIf = "!(".$pConfig['expose_if'].")";
111 111
                     }
112 112
 
113 113
                     if (isset($pConfig['serialized_name'])) {
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 
128 128
                         $colConfig = $pConfig['xml_list'];
129 129
                         if (isset($colConfig['inline'])) {
130
-                            $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline'];
130
+                            $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline'];
131 131
                         }
132 132
 
133 133
                         if (isset($colConfig['entry_name'])) {
134
-                            $pMetadata->xmlEntryName = (string)$colConfig['entry_name'];
134
+                            $pMetadata->xmlEntryName = (string) $colConfig['entry_name'];
135 135
                         }
136 136
 
137 137
                         if (isset($colConfig['skip_when_empty'])) {
138
-                            $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty'];
138
+                            $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty'];
139 139
                         } else {
140 140
                             $pMetadata->xmlCollectionSkipWhenEmpty = true;
141 141
                         }
Please login to merge, or discard this patch.
src/JMS/Serializer/SerializerBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
 
116 116
     protected 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) {
Please login to merge, or discard this patch.
src/JMS/Serializer/Annotation/VirtualProperty.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         }
39 39
 
40 40
         foreach ($data as $key => $value) {
41
-            if (!property_exists(__CLASS__, $key)) {
41
+            if ( ! property_exists(__CLASS__, $key)) {
42 42
                 throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, __CLASS__));
43 43
             }
44 44
             $this->{$key} = $value;
Please login to merge, or discard this patch.
src/JMS/Serializer/Exclusion/GroupsExclusionStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 
77 77
         $groups = $this->groups;
78 78
         foreach ($paths as $index => $path) {
79
-            if (!array_key_exists($path, $groups)) {
79
+            if ( ! array_key_exists($path, $groups)) {
80 80
                 if ($index > 0) {
81 81
                     $groups = array(self::DEFAULT_GROUP);
82 82
                 }
Please login to merge, or discard this patch.
src/JMS/Serializer/XmlSerializationVisitor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             $this->document = $this->createDocument(null, null, false);
209 209
             if ($metadata->xmlRootName) {
210 210
                 $rootName = $metadata->xmlRootName;
211
-                $rootNamespace = $metadata->xmlRootNamespace?:$this->getClassDefaultNamespace($metadata);
211
+                $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata);
212 212
             } else {
213 213
                 $rootName = $this->defaultRootName;
214 214
                 $rootNamespace = $this->defaultRootNamespace;
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
             return;
292 292
         }
293 293
 
294
-        if ($addEnclosingElement = !$this->isInLineCollection($metadata) && ! $metadata->inline) {
294
+        if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) {
295 295
             $elementName = $this->namingStrategy->translateName($metadata);
296 296
 
297 297
             $namespace = null !== $metadata->xmlNamespace
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
     private function isEmptyObject($node, PropertyMetadata $metadata)
336 336
     {
337
-        return $node === null && !$metadata->xmlCollection;
337
+        return $node === null && ! $metadata->xmlCollection;
338 338
     }
339 339
 
340 340
     private function isSkippableCollection(PropertyMetadata $metadata)
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 
345 345
     private function isElementEmpty(\DOMElement $element)
346 346
     {
347
-        return !$element->hasChildNodes() && !$element->hasAttributes();
347
+        return ! $element->hasChildNodes() && ! $element->hasAttributes();
348 348
     }
349 349
 
350 350
     public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context)
@@ -482,17 +482,17 @@  discard block
 block discarded – undo
482 482
         if ($this->currentNode->isDefaultNamespace($namespace)) {
483 483
             return $this->document->createElementNS($namespace, $tagName);
484 484
         }
485
-        if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) {
486
-            $prefix = 'ns-'.  substr(sha1($namespace), 0, 8);
485
+        if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) {
486
+            $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
487 487
         }
488
-        return $this->document->createElementNS($namespace, $prefix . ':' . $tagName);
488
+        return $this->document->createElementNS($namespace, $prefix.':'.$tagName);
489 489
     }
490 490
 
491 491
     private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null)
492 492
     {
493 493
         if (null !== $namespace) {
494
-            if (!$prefix = $node->lookupPrefix($namespace)) {
495
-                $prefix = 'ns-'.  substr(sha1($namespace), 0, 8);
494
+            if ( ! $prefix = $node->lookupPrefix($namespace)) {
495
+                $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
496 496
             }
497 497
             $node->setAttributeNS($namespace, $prefix.':'.$name, $value);
498 498
         } else {
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 
503 503
     private function getClassDefaultNamespace(ClassMetadata $metadata)
504 504
     {
505
-        return (isset($metadata->xmlNamespaces[''])?$metadata->xmlNamespaces['']:null);
505
+        return (isset($metadata->xmlNamespaces['']) ? $metadata->xmlNamespaces[''] : null);
506 506
     }
507 507
 
508 508
     /**
Please login to merge, or discard this patch.
src/JMS/Serializer/Annotation/SerializedName.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
     public function __construct(array $values)
32 32
     {
33
-        if (!isset($values['value']) || !is_string($values['value'])) {
33
+        if ( ! isset($values['value']) || ! is_string($values['value'])) {
34 34
             throw new RuntimeException(sprintf('"value" must be a string.'));
35 35
         }
36 36
 
Please login to merge, or discard this patch.
src/JMS/Serializer/XmlDeserializationVisitor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         if (false !== stripos($data, '<!doctype')) {
69 69
             $internalSubset = $this->getDomDocumentTypeEntitySubset($data);
70
-            if (!in_array($internalSubset, $this->doctypeWhitelist, true)) {
70
+            if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) {
71 71
                 throw new InvalidArgumentException(sprintf(
72 72
                     'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
73 73
                     $internalSubset
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         if ($namespace === null && $this->objectMetadataStack->count()) {
158 158
             $classMetadata = $this->objectMetadataStack->top();
159
-            $namespace = isset($classMetadata->xmlNamespaces[''])?$classMetadata->xmlNamespaces['']:$namespace;
159
+            $namespace = isset($classMetadata->xmlNamespaces['']) ? $classMetadata->xmlNamespaces[''] : $namespace;
160 160
         }
161 161
 
162 162
         if (null !== $namespace) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             $nodes = $data->xpath($entryName);
168 168
         }
169 169
 
170
-        if (!count($nodes)) {
170
+        if ( ! count($nodes)) {
171 171
             if (null === $this->result) {
172 172
                 return $this->result = array();
173 173
             }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
         if ($metadata->xmlCollection) {
260 260
             $enclosingElem = $data;
261
-            if (!$metadata->xmlCollectionInline) {
261
+            if ( ! $metadata->xmlCollectionInline) {
262 262
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
263 263
             }
264 264
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
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
                 return;
277 277
             }
278 278
         } else {
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
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
                 return;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
      */
369 369
     private function getDomDocumentTypeEntitySubset($data)
370 370
     {
371
-        if (!is_string($data)) {
371
+        if ( ! is_string($data)) {
372 372
             $data = (string) $data;
373 373
         }
374 374
 
Please login to merge, or discard this patch.