Completed
Push — master ( 86484b...f97b0a )
by stéphane
05:27
created
sources/nodes/NodeComment.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@
 block discarded – undo
10 10
  */
11 11
 class NodeComment extends Node
12 12
 {
13
-   public function specialProcess(Node &$previous, array &$emptyLines):bool
14
-   {
13
+    public function specialProcess(Node &$previous, array &$emptyLines):bool
14
+    {
15 15
         $previous->getRoot()->add($this);
16 16
         return true;
17
-   }
17
+    }
18 18
 
19
-   public function build(&$parent = null)
20
-   {
19
+    public function build(&$parent = null)
20
+    {
21 21
         $root = $this->getRoot();
22 22
         $yamlObject = $root->getYamlObject();
23 23
         $yamlObject->addComment($this->line, $this->raw);
24
-   }
24
+    }
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
sources/nodes/NodeSetKey.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@
 block discarded – undo
31 31
         $built = is_null($this->value) ? null : $this->value->build();
32 32
         $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" '): $built;
33 33
         $key = json_encode($stringKey, JSON_PARTIAL_OUTPUT_ON_ERROR|JSON_UNESCAPED_SLASHES);
34
-        if (empty($key)) throw new \Exception("Cant serialize complex key: ".var_export($this->value, true));
34
+        if (empty($key)) {
35
+            throw new \Exception("Cant serialize complex key: ".var_export($this->value, true));
36
+        }
35 37
         $parent->{trim($key, '\'" ')} = null;
36 38
     }
37 39
 
Please login to merge, or discard this patch.
sources/Node.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         return false;
131 131
     }
132 132
 
133
-   /**
133
+    /**
134 134
      * Find parent target when current Node indentation is lesser than previous node indentation
135 135
      *
136 136
      * @param Node $previous The previous
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         return $this->getParent();
167 167
     }
168 168
 
169
-   /**
169
+    /**
170 170
      * Find parent target when current Node indentation is superior than previous node indentation
171 171
      *
172 172
      * @param Node $previous The previous
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.
sources/types/YamlObject.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,8 +74,12 @@
 block discarded – undo
74 74
     {
75 75
         $prop = get_object_vars($this);
76 76
         unset($prop["__yaml__object__api"]);
77
-        if (count($prop) > 0) return $prop;
78
-        if (count($this) > 0) return iterator_to_array($this);
77
+        if (count($prop) > 0) {
78
+            return $prop;
79
+        }
80
+        if (count($this) > 0) {
81
+            return iterator_to_array($this);
82
+        }
79 83
         return $this->__yaml__object__api->value ?? "_Empty YamlObject_";
80 84
     }
81 85
 }
Please login to merge, or discard this patch.
sources/NodeList.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,12 +79,12 @@
 block discarded – undo
79 79
      */
80 80
     public function checkTypeCoherence($estimatedType):bool
81 81
     {
82
-       // if ($this->type === self::MAPPING) {
83
-       //     if ($estimatedType === self::SEQUENCE) {
84
-       //         throw new \ParseError("Error : no coherence in types", 1);
85
-       //     }
86
-       // }
87
-       return (bool) $estimatedType;
82
+        // if ($this->type === self::MAPPING) {
83
+        //     if ($estimatedType === self::SEQUENCE) {
84
+        //         throw new \ParseError("Error : no coherence in types", 1);
85
+        //     }
86
+        // }
87
+        return (bool) $estimatedType;
88 88
     }
89 89
 
90 90
     public function build(&$parent = null)
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
         $tmp->rewind();
38 38
         $fqn = __NAMESPACE__."\\$nodeType";
39 39
         foreach ($tmp as $child) {
40
-            if ($child instanceof $fqn) return true;
40
+            if ($child instanceof $fqn) {
41
+                return true;
42
+            }
41 43
         }
42 44
         return false;
43 45
     }
@@ -51,7 +53,9 @@  discard block
 block discarded – undo
51 53
                 && !($child instanceof NodeDirective)
52 54
                 && !($child instanceof NodeBlank)
53 55
                 && !($child instanceof NodeDocstart
54
-                && is_null($child->value)) ) return true;
56
+                && is_null($child->value)) ) {
57
+                return true;
58
+            }
55 59
         }
56 60
         return false;
57 61
     }
@@ -59,9 +63,11 @@  discard block
 block discarded – undo
59 63
     public function push($node)
60 64
     {
61 65
         $type = null;
62
-        if     ($node instanceof NodeItem )    $type = self::SEQUENCE;
63
-        elseif ($node instanceof NodeKey)      $type = self::MAPPING;
64
-        elseif ($node instanceof NodeSetKey
66
+        if     ($node instanceof NodeItem ) {
67
+            $type = self::SEQUENCE;
68
+        } elseif ($node instanceof NodeKey) {
69
+            $type = self::MAPPING;
70
+        } elseif ($node instanceof NodeSetKey
65 71
              || $node instanceof NodeSetValue) {
66 72
             $type = self::SET;
67 73
         } elseif ($node instanceof NodeScalar ){
Please login to merge, or discard this patch.
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
@@ -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/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/NodeLitFolded.php 1 patch
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.
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.