Passed
Push — master ( dd077a...e2a7b5 )
by stéphane
05:33
created
sources/Builder.php 2 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.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,8 +89,12 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public static function getScalar(string $v, bool $onlyScalar = false)
91 91
     {
92
-        if (Regex::isDate($v))   return self::$dateAsObject && !$onlyScalar ? date_create($v) : $v;
93
-        if (Regex::isNumber($v)) return self::getNumber($v);
92
+        if (Regex::isDate($v)) {
93
+            return self::$dateAsObject && !$onlyScalar ? date_create($v) : $v;
94
+        }
95
+        if (Regex::isNumber($v)) {
96
+            return self::getNumber($v);
97
+        }
94 98
         $types = ['yes'   => true,
95 99
                   'no'    => false,
96 100
                   'true'  => true,
@@ -113,8 +117,12 @@  discard block
 block discarded – undo
113 117
      */
114 118
     private static function getNumber(string $v)
115 119
     {
116
-        if (preg_match(Regex::OCTAL_NUM, $v)) return intval(base_convert($v, 8, 10));
117
-        if (preg_match(Regex::HEX_NUM, $v))   return intval(base_convert($v, 16, 10));
120
+        if (preg_match(Regex::OCTAL_NUM, $v)) {
121
+            return intval(base_convert($v, 8, 10));
122
+        }
123
+        if (preg_match(Regex::HEX_NUM, $v)) {
124
+            return intval(base_convert($v, 16, 10));
125
+        }
118 126
         return is_bool(strpos($v, '.')) ? intval($v) : floatval($v);
119 127
     }
120 128
 
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/NodeKey.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     public function setIdentifier(string $keyString)
28 28
     {
29 29
         if ($keyString === '') {
30
-           throw new \ParseError(sprintf(self::ERROR_NO_KEYNAME, $this->line));
30
+            throw new \ParseError(sprintf(self::ERROR_NO_KEYNAME, $this->line));
31 31
         } else {
32 32
             $keyNode = NodeFactory::get($keyString);
33 33
             if (!is_null($keyNode->anchor)) {
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
@@ -31,14 +31,14 @@
 block discarded – undo
31 31
             $result = $this->getChildValue($first, $indent);
32 32
             foreach ($list as $child) {
33 33
                 $separator = ($result && $result[-1] === "\n") ? '' : $refSeparator;
34
-                if($child->indent > $indent || $child instanceof NodeBlank) {
34
+                if ($child->indent > $indent || $child instanceof NodeBlank) {
35 35
                     $separator = "\n";
36 36
                 }
37 37
                 $val = $this->getChildValue($child, $indent);
38 38
                 if ($child->value instanceof NodeList) {
39 39
                     $val = "\n".$this->getFinalString($child->value, $indent);
40 40
                 }
41
-                $result .= $separator .$val;
41
+                $result .= $separator.$val;
42 42
             }
43 43
         }
44 44
         return $result;
Please login to merge, or discard this patch.
sources/Node.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getParent(int $indent = null):Node
67 67
     {
68
-        if (!is_int($indent)){
68
+        if (!is_int($indent)) {
69 69
             if ($this->_parent instanceof Node) {
70 70
                 return $this->_parent;
71 71
             } else {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         if ($this->tag)        $props['tag']        = "($this->tag)";
216 216
         if ($this->value)      $props['value']      = $this->value;
217 217
         // $props['value'] = $this->value;
218
-        $props['raw']   = $this->raw;
218
+        $props['raw'] = $this->raw;
219 219
         if (!$this->_parent)  $props['parent'] = 'NO PARENT!!!';
220 220
         return $props;
221 221
     }
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -210,13 +210,23 @@
 block discarded – undo
210 210
     {
211 211
         $props = [];
212 212
         $props['line->indent'] = "$this->line -> $this->indent";
213
-        if ($this->identifier) $props['identifier'] = "($this->identifier)";
214
-        if ($this->anchor)     $props['anchor']     = "($this->anchor)";
215
-        if ($this->tag)        $props['tag']        = "($this->tag)";
216
-        if ($this->value)      $props['value']      = $this->value;
213
+        if ($this->identifier) {
214
+            $props['identifier'] = "($this->identifier)";
215
+        }
216
+        if ($this->anchor) {
217
+            $props['anchor']     = "($this->anchor)";
218
+        }
219
+        if ($this->tag) {
220
+            $props['tag']        = "($this->tag)";
221
+        }
222
+        if ($this->value) {
223
+            $props['value']      = $this->value;
224
+        }
217 225
         // $props['value'] = $this->value;
218 226
         $props['raw']   = $this->raw;
219
-        if (!$this->_parent)  $props['parent'] = 'NO PARENT!!!';
227
+        if (!$this->_parent) {
228
+            $props['parent'] = 'NO PARENT!!!';
229
+        }
220 230
         return $props;
221 231
     }
222 232
 }
Please login to merge, or discard this patch.