Passed
Push — master ( d590ba...6d7168 )
by stéphane
02:47
created
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.
sources/nodes/NodeBlank.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 {
13 13
     public function add(Node $child):Node
14 14
     {
15
-        if($this->_parent instanceof Node) {
15
+        if ($this->_parent instanceof Node) {
16 16
             return $this->_parent->add($child);
17 17
         } else {
18 18
             throw new \ParseError(__METHOD__." no parent to add to", 1);
Please login to merge, or discard this patch.
sources/NodeFactory.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
         elseif ((bool) preg_match(Regex::KEY, $trimmed, $matches)) return new NodeKey($nodeString, $line, $matches);
22 22
         else {
23 23
             $first = $trimmed[0];
24
-            $stringGroups = ["-" ,'>|' ,'"\'',"#%" ,"{[" ,":?" ,'*&!'];
25
-            $methodGroups = ['Hyphen','Literal','Quoted','Special','Compact','SetElement','NodeAction'];
24
+            $stringGroups = ["-", '>|', '"\'', "#%", "{[", ":?", '*&!'];
25
+            $methodGroups = ['Hyphen', 'Literal', 'Quoted', 'Special', 'Compact', 'SetElement', 'NodeAction'];
26 26
             foreach ($stringGroups as $groupIndex => $stringRef) {
27 27
                 if (is_int(strpos($stringRef, $first))) {
28 28
                     $methodName = 'on'.$methodGroups[$groupIndex];
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
         if (!((bool) preg_match(Regex::NODE_ACTIONS, trim($nodeString), $matches))) {
128 128
             return new NodeScalar($nodeString, $line);
129 129
         }
130
-        $action = trim($matches['action']);//var_dump($matches);
130
+        $action = trim($matches['action']); //var_dump($matches);
131 131
         switch ($action[0]) {
132
-            case '!': return new NodeTag   ($nodeString, $line);
132
+            case '!': return new NodeTag($nodeString, $line);
133 133
             case '&': return new NodeAnchor($nodeString, $line);
134 134
             case '*': return new NodeAnchor($nodeString, $line);
135 135
             // default:
Please login to merge, or discard this patch.
Braces   +19 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,10 +16,13 @@  discard block
 block discarded – undo
16 16
     final public static function get($nodeString = null, $line = 0):Node
17 17
     {
18 18
         $trimmed = ltrim($nodeString);
19
-        if ($trimmed === '')                                return new NodeBlank($nodeString, $line);
20
-        elseif (substr($trimmed, 0, 3) === '...')           return new NodeDocEnd($nodeString, $line);
21
-        elseif ((bool) preg_match(Regex::KEY, $trimmed, $matches)) return new NodeKey($nodeString, $line, $matches);
22
-        else {
19
+        if ($trimmed === '') {
20
+            return new NodeBlank($nodeString, $line);
21
+        } elseif (substr($trimmed, 0, 3) === '...') {
22
+            return new NodeDocEnd($nodeString, $line);
23
+        } elseif ((bool) preg_match(Regex::KEY, $trimmed, $matches)) {
24
+            return new NodeKey($nodeString, $line, $matches);
25
+        } else {
23 26
             $first = $trimmed[0];
24 27
             $stringGroups = ["-" ,'>|' ,'"\'',"#%" ,"{[" ,":?" ,'*&!'];
25 28
             $methodGroups = ['Hyphen','Literal','Quoted','Special','Compact','SetElement','NodeAction'];
@@ -90,10 +93,13 @@  discard block
 block discarded – undo
90 93
     final private static function onCompact(string $first, string $nodeString, int $line):Node
91 94
     {
92 95
         json_decode($nodeString, false, 512, self::JSON_OPTIONS);
93
-        if (json_last_error() === \JSON_ERROR_NONE)             return new NodeJSON($nodeString, $line);
94
-        elseif ((bool) preg_match(Regex::MAPPING, trim($nodeString)))  return new NodeCompactMapping($nodeString, $line);
95
-        elseif ((bool) preg_match(Regex::SEQUENCE, trim($nodeString))) return new NodeCompactSequence($nodeString, $line);
96
-        else {
96
+        if (json_last_error() === \JSON_ERROR_NONE) {
97
+            return new NodeJSON($nodeString, $line);
98
+        } elseif ((bool) preg_match(Regex::MAPPING, trim($nodeString))) {
99
+            return new NodeCompactMapping($nodeString, $line);
100
+        } elseif ((bool) preg_match(Regex::SEQUENCE, trim($nodeString))) {
101
+            return new NodeCompactSequence($nodeString, $line);
102
+        } else {
97 103
             return new NodePartial($nodeString, $line);
98 104
         }
99 105
     }
@@ -108,9 +114,11 @@  discard block
 block discarded – undo
108 114
      */
109 115
     final private static function onHyphen(string $first, string $nodeString, int $line):Node
110 116
     {
111
-        if (substr($nodeString, 0, 3) === '---')              return new NodeDocStart($nodeString, $line);
112
-        elseif ((bool) preg_match(Regex::ITEM, ltrim($nodeString)))  return new NodeItem($nodeString, $line);
113
-        else {
117
+        if (substr($nodeString, 0, 3) === '---') {
118
+            return new NodeDocStart($nodeString, $line);
119
+        } elseif ((bool) preg_match(Regex::ITEM, ltrim($nodeString))) {
120
+            return new NodeItem($nodeString, $line);
121
+        } else {
114 122
             return new NodeScalar($nodeString, $line);
115 123
         }
116 124
     }
Please login to merge, or discard this patch.
sources/Loader.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,8 +125,12 @@
 block discarded – undo
125 125
         try {
126 126
             foreach ($generator as $lineNb => $lineString) {
127 127
                 $node = NodeFactory::get($lineString, $lineNb);
128
-                if ($this->_debug === 1) echo get_class($node)."\n";
129
-                if ($this->needsSpecialProcess($node, $previous)) continue;
128
+                if ($this->_debug === 1) {
129
+                    echo get_class($node)."\n";
130
+                }
131
+                if ($this->needsSpecialProcess($node, $previous)) {
132
+                    continue;
133
+                }
130 134
                 $this->attachBlankLines($previous);
131 135
                 switch ($node->indent <=> $previous->indent) {
132 136
                     case -1: $target = $previous->getTargetOnLessIndent($node);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
     //public
16 16
     /* @var null|string */
17 17
     public static $error;
18
-    public const IGNORE_DIRECTIVES     = 1;//DONT include_directive
19
-    public const IGNORE_COMMENTS       = 2;//DONT include_comments
20
-    public const NO_PARSING_EXCEPTIONS = 4;//DONT throw Exception on parsing errors
21
-    public const NO_OBJECT_FOR_DATE    = 8;//DONT import date strings as dateTime Object
18
+    public const IGNORE_DIRECTIVES     = 1; //DONT include_directive
19
+    public const IGNORE_COMMENTS       = 2; //DONT include_comments
20
+    public const NO_PARSING_EXCEPTIONS = 4; //DONT throw Exception on parsing errors
21
+    public const NO_OBJECT_FOR_DATE    = 8; //DONT import date strings as dateTime Object
22 22
 
23 23
     //private
24 24
     /* @var null|array */
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 $previous = $target->add($node);
139 139
             }
140 140
             $this->attachBlankLines($previous);
141
-            if ($this->_debug === 1){
141
+            if ($this->_debug === 1) {
142 142
                 return;
143 143
             }
144 144
             return Builder::buildContent($root, $this->_debug);
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
     {
180 180
         $deepest = $previous->getDeepestNode();
181 181
         if ($deepest instanceof NodePartial) {
182
-            return $deepest->specialProcess($current,  $this->_blankBuffer);
183
-        } elseif(!($current instanceof NodePartial)) {
182
+            return $deepest->specialProcess($current, $this->_blankBuffer);
183
+        } elseif (!($current instanceof NodePartial)) {
184 184
             return $current->specialProcess($previous, $this->_blankBuffer);
185 185
         }
186 186
         return false;
Please login to merge, or discard this patch.