Passed
Push — master ( c4ae7b...dd077a )
by stéphane
01:37
created
sources/Dumper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         foreach ($array as $key => $item) {
144 144
             $lineStart = current($refKeys) === $key ? "- " : "- $key: ";
145 145
             if (is_scalar($item)) {
146
-                self::add($lineStart.self::dump($item,0), $indent);
146
+                self::add($lineStart.self::dump($item, 0), $indent);
147 147
             } else {
148 148
                 self::add(rtrim($lineStart), $indent);
149 149
                 self::dump($item, $indent + self::INDENT);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         if (is_array($subject) || $subject instanceof \ArrayIterator) {
214 214
             $max = count($subject);
215 215
             $objectAsArray = is_array($subject) ? $subject : $subject->getArrayCopy();
216
-            if(array_keys($objectAsArray) !== range(0, $max-1)) {
216
+            if (array_keys($objectAsArray) !== range(0, $max - 1)) {
217 217
                 $pairs = $objectAsArray;
218 218
             } else {
219 219
                 $valuesList = [];
Please login to merge, or discard this patch.
examples/load_modify_save.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Dallgoot\Yaml;
3 3
 
4
-require_once __DIR__ . '/../../dependencies/autoload.php';
4
+require_once __DIR__.'/../../dependencies/autoload.php';
5 5
 
6 6
 use Dallgoot;
7 7
 
8
-$fileName = __DIR__ . '/../dummy.yml';
8
+$fileName = __DIR__.'/../dummy.yml';
9 9
 
10 10
 $yamlObject = Yaml::parseFile($fileName, $options = null, $debug = null);
11 11
 
Please login to merge, or discard this patch.
sources/Loader.php 1 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|false|array */
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     /* @var null|string */
27 27
     private $filePath;
28 28
     /* @var integer */
29
-    private $_debug = 0;///TODO: determine levels
29
+    private $_debug = 0; ///TODO: determine levels
30 30
     /* @var integer */
31 31
     private $_options = 0;
32 32
     /* @var array */
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
     {
174 174
         $deepest = $previous->getDeepestNode();
175 175
         if ($deepest instanceof NodePartial) {
176
-            return $deepest->specialProcess($current,  $this->_blankBuffer);
177
-        } elseif(!($current instanceof NodePartial)) {
176
+            return $deepest->specialProcess($current, $this->_blankBuffer);
177
+        } elseif (!($current instanceof NodePartial)) {
178 178
             return $current->specialProcess($previous, $this->_blankBuffer);
179 179
         }
180 180
         return false;
Please login to merge, or discard this patch.
sources/NodeList.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         foreach ($tmp as $child) {
48 48
             if (!($child instanceof NodeComment)
49 49
                 && !($child instanceof NodeDirective)
50
-                && !($child instanceof NodeDocstart && is_null($child->value)) ) return true;
50
+                && !($child instanceof NodeDocstart && is_null($child->value))) return true;
51 51
         }
52 52
         return false;
53 53
     }
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
     public function push($node)
56 56
     {
57 57
         $type = null;
58
-        if     ($node instanceof NodeItem )    $type = self::SEQUENCE;
58
+        if ($node instanceof NodeItem)    $type = self::SEQUENCE;
59 59
         elseif ($node instanceof NodeKey)      $type = self::MAPPING;
60 60
         elseif ($node instanceof NodeSetKey
61 61
              || $node instanceof NodeSetValue) {
62 62
             $type = self::SET;
63
-        } elseif ($node instanceof NodeScalar ){
63
+        } elseif ($node instanceof NodeScalar) {
64 64
             $type = self::MULTILINE;
65 65
         }
66 66
         if (!is_null($type) && $this->checkTypeCoherence($type)) {
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
             if ($child instanceof NodeComment) {
144 144
                 $child->build();
145 145
             } else {
146
-                if($child->value instanceof NodeComment) {
146
+                if ($child->value instanceof NodeComment) {
147 147
                     $child->value->build();
148 148
                     $child->value = null;
149
-                } elseif($child->value instanceof NodeList) {
149
+                } elseif ($child->value instanceof NodeList) {
150 150
                     $child->value = $child->value->filterComment();
151 151
                 }
152 152
                 $out->push($child);
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/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/NodeCompactSequence.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::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1,-1)), $matches);
16
+        preg_match_all(Regex::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1, -1)), $matches);
17 17
         foreach ($matches['item'] as $key => $item) {
18 18
             $i = new NodeItem('', $line);
19 19
             $i->indent = null;
Please login to merge, or discard this patch.
sources/nodes/NodeLitFolded.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             $refSeparator = ' ';
30 30
             $result = substr($first->raw, $first->indent);
31 31
             foreach ($list as $child) {
32
-                if($child->indent > $refIndent || ($child instanceof NodeBlank)) {
32
+                if ($child->indent > $refIndent || ($child instanceof NodeBlank)) {
33 33
                     $separator = "\n";
34 34
                 } else {
35 35
                     $separator = !empty($result) && $result[-1] === "\n" ? '' : $refSeparator;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                         $val = $child->build();
43 43
                     }
44 44
                 }
45
-                $result .= $separator .$val;
45
+                $result .= $separator.$val;
46 46
             }
47 47
         }
48 48
         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(ltrim($nodeString), 1,-1)), $matches);
16
+        preg_match_all(Regex::MAPPING_VALUES, trim(substr(ltrim($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.