Completed
Push — master ( 5a065a...8bfcf4 )
by Tomasz
02:12
created
src/Format/AbstractFormat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,20 +10,20 @@
 block discarded – undo
10 10
 {
11 11
     protected function doSerialize($var, Handlers $handlers)
12 12
     {
13
-        if(is_object($var)) {
13
+        if (is_object($var)) {
14 14
             $class = get_class($var);
15 15
             $handler = $handlers->getHandler($class);
16 16
 
17
-            if(null === $handler) {
17
+            if (null === $handler) {
18 18
                 throw new \RuntimeException(sprintf('No serialization handler for class %s!', $class));
19 19
             }
20 20
 
21 21
             return $this->doSerialize(call_user_func_array($handler, array($var)), $handlers);
22 22
         }
23 23
 
24
-        if(is_array($var)) {
24
+        if (is_array($var)) {
25 25
             $return = array();
26
-            foreach($var as $key => $value) {
26
+            foreach ($var as $key => $value) {
27 27
                 $return[$key] = $this->doSerialize($value, $handlers);
28 28
             }
29 29
 
Please login to merge, or discard this patch.
src/Serializard.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     {
37 37
         $format = $this->formats->get($alias);
38 38
 
39
-        if(false === $format instanceof FormatInterface) {
39
+        if (false === $format instanceof FormatInterface) {
40 40
             throw new \RuntimeException(sprintf('No registered format for alias %s!', $alias));
41 41
         }
42 42
 
Please login to merge, or discard this patch.
src/HandlerContainer/HandlerContainer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
     public function add($class, $root, $handler)
13 13
     {
14
-        if(false === is_callable($handler)) {
14
+        if (false === is_callable($handler)) {
15 15
             throw new \RuntimeException(sprintf('Invalid handler for class %s!', $class));
16 16
         }
17 17
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         $handler = $this->getHandler($class);
25 25
 
26
-        if(null === $handler) {
26
+        if (null === $handler) {
27 27
             throw new \RuntimeException(sprintf('Handler for class %s does not exist!', $class));
28 28
         }
29 29
 
Please login to merge, or discard this patch.
src/Normalizer/JmsSerializerNormalizer.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,32 +19,32 @@  discard block
 block discarded – undo
19 19
     public function __invoke($var)
20 20
     {
21 21
         $data = file_get_contents($this->path);
22
-        if(!$data) {
22
+        if (!$data) {
23 23
             throw new \RuntimeException(sprintf('Failed to read file at path %s!', $this->path));
24 24
         }
25 25
 
26 26
         $yaml = Yaml::parse($data);
27 27
         $keys = array_keys($yaml);
28 28
         $yaml = $yaml[$keys[0]];
29
-        if(!$yaml) {
30
-            throw new \InvalidArgumentException('No config at '.$this->path);
29
+        if (!$yaml) {
30
+            throw new \InvalidArgumentException('No config at ' . $this->path);
31 31
         }
32 32
 
33 33
         $hasPolicy = array_key_exists('exclusion_policy', $yaml);
34
-        if(!$hasPolicy || ($hasPolicy && 'ALL' !== $yaml['exclusion_policy'])) {
34
+        if (!$hasPolicy || ($hasPolicy && 'ALL' !== $yaml['exclusion_policy'])) {
35 35
             throw new \RuntimeException(sprintf('This serializer supports only ALL, %s given!', $yaml['exclusion_policy']));
36 36
         }
37 37
 
38 38
         $ref = new \ReflectionObject($var);
39 39
         $result = [];
40
-        foreach($yaml['properties'] as $key => $config) {
41
-            if($config['expose'] !== true) {
40
+        foreach ($yaml['properties'] as $key => $config) {
41
+            if ($config['expose'] !== true) {
42 42
                 continue;
43 43
             }
44 44
 
45 45
             $name = array_key_exists('serialized_name', $config) ? $config['serialized_name'] : $key;
46 46
 
47
-            if($ref->hasProperty($key)) {
47
+            if ($ref->hasProperty($key)) {
48 48
                 $prop = $ref->getProperty($key);
49 49
                 $prop->setAccessible(true);
50 50
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
                 continue;
54 54
             }
55 55
 
56
-            $method = 'get'.ucfirst($key);
57
-            if(method_exists($var, $method)) {
56
+            $method = 'get' . ucfirst($key);
57
+            if (method_exists($var, $method)) {
58 58
                 $result[$name] = call_user_func_array([$var, $method], []);
59 59
 
60 60
                 continue;
Please login to merge, or discard this patch.
src/Normalizer/ReflectionNormalizer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
         $ref = new \ReflectionObject($var);
19 19
 
20 20
         $result = [];
21
-        foreach($ref->getProperties() as $property) {
22
-            if(in_array($property->getName(), $this->skipped)) {
21
+        foreach ($ref->getProperties() as $property) {
22
+            if (in_array($property->getName(), $this->skipped)) {
23 23
                 continue;
24 24
             }
25 25
 
Please login to merge, or discard this patch.
src/Format/XmlFormat.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     {
30 30
         /** @var \DOMDocument|\DOMElement $doc */
31 31
         /** @var \DOMDocument|\DOMElement $parent */
32
-        if(is_object($var)) {
32
+        if (is_object($var)) {
33 33
             $handler = $handlers->getHandler(get_class($var));
34 34
             $arr = $handler($var);
35 35
             $this->doSerialize($arr, $handlers, $doc, $parent, $handlers->getRoot(get_class($var)));
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
             return;
38 38
         }
39 39
 
40
-        if(is_array($var)) {
40
+        if (is_array($var)) {
41 41
             $item = $key ? $doc->createElement($key) : $parent;
42
-            foreach($var as $index => $value) {
42
+            foreach ($var as $index => $value) {
43 43
                 $this->doSerialize($value, $handlers, $doc, $item, $index);
44 44
             }
45 45
             !$key ?: $parent->appendChild($item);
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
         /** @var \DOMElement $parent */
67 67
         /** @var \DOMElement $node */
68 68
         $tags = array();
69
-        foreach($parent->childNodes as $node) {
70
-            if($node->nodeName === '#text') {
69
+        foreach ($parent->childNodes as $node) {
70
+            if ($node->nodeName === '#text') {
71 71
                 continue;
72 72
             }
73
-            if($node->childNodes->length === 1 && $node->childNodes->item(0) instanceof \DOMText) {
73
+            if ($node->childNodes->length === 1 && $node->childNodes->item(0) instanceof \DOMText) {
74 74
                 $ret[$node->tagName] = $node->childNodes->item(0)->nodeValue;
75 75
                 continue;
76 76
             }
77 77
             $result = $this->parse($doc, $node);
78
-            if(array_key_exists($node->tagName, $ret)) {
78
+            if (array_key_exists($node->tagName, $ret)) {
79 79
                 $tags[] = $node->tagName;
80 80
                 $ret = array($ret[$node->tagName]);
81 81
                 $ret[] = $result;
82 82
                 continue;
83 83
             }
84
-            if(in_array($node->tagName, $tags)) {
84
+            if (in_array($node->tagName, $tags)) {
85 85
                 $ret[] = $result;
86 86
                 continue;
87 87
             }
Please login to merge, or discard this patch.