Completed
Push — master ( 86484b...f97b0a )
by stéphane
05:27
created
sources/Builder.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -92,13 +92,13 @@
 block discarded – undo
92 92
         if (Regex::isDate($v))   return self::$dateAsObject && !$onlyScalar ? date_create($v) : $v;
93 93
         if (Regex::isNumber($v)) return self::getNumber($v);
94 94
         $types = ['yes'   => true,
95
-                  'no'    => false,
96
-                  'true'  => true,
97
-                  'false' => false,
98
-                  'null'  => null,
99
-                  '.inf'  => \INF,
100
-                  '-.inf' => -\INF,
101
-                  '.nan'  => \NAN
95
+                    'no'    => false,
96
+                    'true'  => true,
97
+                    'false' => false,
98
+                    'null'  => null,
99
+                    '.inf'  => \INF,
100
+                    '-.inf' => -\INF,
101
+                    '.nan'  => \NAN
102 102
         ];
103 103
         return array_key_exists(strtolower($v), $types) ? $types[strtolower($v)] : $v;
104 104
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
                     $buffer->push($child);
46 46
                 }
47 47
             }
48
-            $documents[] = self::buildDocument($buffer, count($documents) +1);
48
+            $documents[] = self::buildDocument($buffer, count($documents) + 1);
49 49
         } catch (\Exception|\Error|\ParseError $e) {
50 50
             throw new \Exception($e->getMessage(), 1, $e);
51 51
         }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -112,8 +112,12 @@  discard block
 block discarded – undo
112 112
  \.nan | \.NaN | \.NAN   tag:yaml.org,2002:float (Not a number)
113 113
  *   tag:yaml.org,2002:str (Default)
114 114
  */
115
-        if (Regex::isDate($v))   return self::$dateAsObject && !$onlyScalar ? date_create($v) : $v;
116
-        if (Regex::isNumber($v)) return self::getNumber($v);
115
+        if (Regex::isDate($v)) {
116
+            return self::$dateAsObject && !$onlyScalar ? date_create($v) : $v;
117
+        }
118
+        if (Regex::isNumber($v)) {
119
+            return self::getNumber($v);
120
+        }
117 121
         $types = ['yes'   => true,
118 122
                   'no'    => false,
119 123
                   'true'  => true,
@@ -136,8 +140,12 @@  discard block
 block discarded – undo
136 140
      */
137 141
     private static function getNumber(string $v)
138 142
     {
139
-        if ((bool) preg_match(Regex::OCTAL_NUM, $v)) return intval(base_convert($v, 8, 10));
140
-        if ((bool) preg_match(Regex::HEX_NUM, $v))   return intval(base_convert($v, 16, 10));
143
+        if ((bool) preg_match(Regex::OCTAL_NUM, $v)) {
144
+            return intval(base_convert($v, 8, 10));
145
+        }
146
+        if ((bool) preg_match(Regex::HEX_NUM, $v)) {
147
+            return intval(base_convert($v, 16, 10));
148
+        }
141 149
         return is_bool(strpos($v, '.')) || substr_count($v, '.') > 1 ? intval($v) : floatval($v);
142 150
     }
143 151
 
Please login to merge, or discard this patch.
sources/nodes/NodeDocStart.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
         if (is_null($this->value)) {
39 39
             return null;
40 40
         } else {
41
-            if ($this->value instanceof NodeTag){
41
+            if ($this->value instanceof NodeTag) {
42 42
                 $parent->addTag($this->value->tag);
43 43
                 $this->value->build($parent);
44 44
             } else {
Please login to merge, or discard this patch.
sources/nodes/NodeLit.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         $result = '';
23 23
         $list = $value->filterComment();
24 24
         if ($this->identifier !== '+') {
25
-             self::litteralStripTrailing($list);
25
+                self::litteralStripTrailing($list);
26 26
         }
27 27
         if ($list->count()) {
28 28
             $list->setIteratorMode(NodeList::IT_MODE_DELETE);
Please login to merge, or discard this patch.
sources/nodes/NodeItem.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
         if ($value instanceof NodeKey && $child instanceof NodeKey) {
29 29
             if ($value->indent === $child->indent) {
30 30
                 return parent::add($child);
31
-            } elseif ($value->isAwaitingChild($child)){
31
+            } elseif ($value->isAwaitingChild($child)) {
32 32
                 return $value->add($child);
33 33
             } else {
34 34
                 // throw new \ParseError('key ('.$value->identifier.')@'.$value->line.' has already a value', 1);
Please login to merge, or discard this patch.
sources/nodes/NodeLitFolded.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
         $result = '';
22 22
         $list = $value->filterComment();
23 23
         if ($this->identifier !== '+') {
24
-             self::litteralStripLeading($list);
25
-             self::litteralStripTrailing($list);
24
+                self::litteralStripLeading($list);
25
+                self::litteralStripTrailing($list);
26 26
         }
27 27
         if ($list->count()) {
28 28
             $refSeparator = ' ';
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
             $result = $this->getChildValue($first, $indent);
33 33
             foreach ($list as $child) {
34 34
                 $separator = ($result && $result[-1] === "\n") ? '' : $refSeparator;
35
-                if($child->indent > $indent || $child instanceof NodeBlank) {
35
+                if ($child->indent > $indent || $child instanceof NodeBlank) {
36 36
                     $separator = "\n";
37 37
                 }
38
-                $result .= $separator .$this->getChildValue($child, $indent);
38
+                $result .= $separator.$this->getChildValue($child, $indent);
39 39
             }
40 40
         }
41 41
         return $result;
Please login to merge, or discard this patch.
sources/nodes/NodeCompactMapping.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct(string $nodeString, int $line)
14 14
     {
15 15
         parent::__construct($nodeString, $line);
16
-        preg_match_all(Regex::MAPPING_VALUES, trim(substr(trim($nodeString), 1,-1)), $matches);
16
+        preg_match_all(Regex::MAPPING_VALUES, trim(substr(trim($nodeString), 1, -1)), $matches);
17 17
         foreach ($matches['k'] as $index => $property) {
18 18
             $pair = $property.': '.trim($matches['v'][$index]);
19 19
             $child = NodeFactory::get($pair, $line);
Please login to merge, or discard this patch.
sources/nodes/NodeKey.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     public function add(Node $child):Node
54 54
     {
55
-        if ($this->value instanceof Node && Yaml::isOneOf($this->value, ['NodeLit','NodeLitFolded', 'NodeAnchor'])) {
55
+        if ($this->value instanceof Node && Yaml::isOneOf($this->value, ['NodeLit', 'NodeLitFolded', 'NodeAnchor'])) {
56 56
             return $this->value->add($child);
57 57
         } else {
58 58
             return parent::add($child);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         if ($current instanceof NodeComment) {
88 88
             return true;
89 89
         }
90
-        if($current instanceof NodeScalar) {
90
+        if ($current instanceof NodeScalar) {
91 91
             return Yaml::isOneOf($node, ['NodeScalar', 'NodeBlank']);
92 92
         }
93 93
         if ($current instanceof NodeItem) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
     public function setIdentifier(string $keyString)
34 34
     {
35 35
         if ($keyString === '') {
36
-           throw new \ParseError(sprintf(self::ERROR_NO_KEYNAME, $this->line));
36
+            throw new \ParseError(sprintf(self::ERROR_NO_KEYNAME, $this->line));
37 37
         } else {
38 38
             $keyNode = NodeFactory::get($keyString);
39 39
             if ($keyNode instanceof NodeTag || $keyNode instanceof NodeQuoted) {
Please login to merge, or discard this patch.
sources/nodes/NodeLiterals.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@
 block discarded – undo
25 25
 
26 26
     public function add(Node $child):Node
27 27
     {
28
-        if (is_null($this->value)) $this->value = new NodeList();
28
+        if (is_null($this->value)) {
29
+            $this->value = new NodeList();
30
+        }
29 31
         $candidate = $child;
30 32
         if (!Yaml::isOneOf($child, ['NodeScalar', 'NodeBlank', 'NodeComment', 'NodeQuoted'])) {
31 33
             $candidate = new NodeScalar((string) $child->raw, $child->line);
Please login to merge, or discard this patch.
sources/Yaml.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,9 @@
 block discarded – undo
107 107
     {
108 108
         foreach ($comparison as $className) {
109 109
             $fqn = __NAMESPACE__."\\Yaml\\$className";
110
-            if ($subject instanceof $fqn) return true;
110
+            if ($subject instanceof $fqn) {
111
+                return true;
112
+            }
111 113
         }
112 114
         return false;
113 115
     }
Please login to merge, or discard this patch.