Completed
Push — master ( 23b4c3...cb8b18 )
by stéphane
02:37
created
yaml/Loader.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
     //public
18 18
     /* @var null|string */
19 19
     public static $error;
20
-    public const IGNORE_DIRECTIVES = 1;//DONT include_directive
21
-    public const IGNORE_COMMENTS    = 2;//DONT include_comments
22
-    public const NO_PARSING_EXCEPTIONS = 4;//DONT throw Exception on parsing errors
23
-    public const NO_OBJECT_FOR_DATE = 8;//DONT import date strings as dateTime Object
20
+    public const IGNORE_DIRECTIVES = 1; //DONT include_directive
21
+    public const IGNORE_COMMENTS    = 2; //DONT include_comments
22
+    public const NO_PARSING_EXCEPTIONS = 4; //DONT throw Exception on parsing errors
23
+    public const NO_OBJECT_FOR_DATE = 8; //DONT import date strings as dateTime Object
24 24
 
25 25
     //privates
26 26
     /* @var null|false|array */
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     /* @var null|string */
29 29
     private $filePath;
30 30
     /* @var integer */
31
-    private $debug = 0;///TODO: determine levels
31
+    private $debug = 0; ///TODO: determine levels
32 32
     /* @var integer */
33 33
     private $options = 0;
34 34
     //Exceptions messages
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $source = $this->content ?? preg_split("/\n/m", preg_replace('/(\r\n|\r)/', "\n", $strContent), 0, PREG_SPLIT_DELIM_CAPTURE);
79 79
         //TODO : be more permissive on $strContent values
80 80
         if (!is_array($source) || !count($source)) throw new \Exception(self::EXCEPTION_LINE_SPLIT);
81
-        return function () use($source) {
81
+        return function() use($source) {
82 82
             foreach ($source as $key => $value) {
83 83
                 yield ++$key => $value;
84 84
             }
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
                 $target = $previous;
112 112
                 switch ($n->indent <=> $previous->indent) {
113 113
                     case -1:
114
-                        $target = $previous->getParent($n->indent);break;//, $n->type & Y::ITEM ? Y::KEY : null);
114
+                        $target = $previous->getParent($n->indent); break; //, $n->type & Y::ITEM ? Y::KEY : null);
115 115
                     case 0:
116
-                        $this->onEqualIndent($n, $previous, $target);break;
116
+                        $this->onEqualIndent($n, $previous, $target); break;
117 117
                     default:
118 118
                         $this->onMoreIndent($previous, $target);
119 119
                 }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     {
157 157
         $deepest = $previous->getDeepestNode();
158 158
         if ($n->type & Y::KEY && $n->indent === 0) {
159
-            $target = $previous->getParent(-1);//get root
159
+            $target = $previous->getParent(-1); //get root
160 160
         } elseif ($n->type & Y::ITEM && $deepest->type & Y::KEY && is_null($deepest->value)) {
161 161
             $target = $deepest;
162 162
         } else {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                   && !($deepest->type & Y::LITTERALS)) {
193 193
             // $previous->getParent(0)->add($n);
194 194
             return true;
195
-        } elseif ($n->type & Y::TAG && is_null($n->value) ){//&& $previous->type & (Y::ROOT|Y::DOC_START|Y::DOC_END)) {
195
+        } elseif ($n->type & Y::TAG && is_null($n->value)) {//&& $previous->type & (Y::ROOT|Y::DOC_START|Y::DOC_END)) {
196 196
             $n->value = '';
197 197
         }
198 198
         return false;
Please login to merge, or discard this patch.