Test Failed
Push — master ( f97b0a...758f0b )
by stéphane
02:39
created
sources/DumperHandlers.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,8 +87,8 @@
 block discarded – undo
87 87
     private function dumpYamlObject(YamlObject $obj):string
88 88
     {
89 89
         if ($this->multipleDocs || $obj->hasDocStart() || $obj->isTagged() || $obj->isScalar()) {
90
-           $this->multipleDocs = true;
91
-          // && $this->$result instanceof DLL) $this->$result->push("---");
90
+            $this->multipleDocs = true;
91
+            // && $this->$result instanceof DLL) $this->$result->push("---");
92 92
         }
93 93
         if (count($obj) > 0) {
94 94
             return $this->iteratorToString($obj, '-', 0);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function dump($dataType, int $indent):string
34 34
     {
35
-        if(is_null($dataType)) {
35
+        if (is_null($dataType)) {
36 36
             return '';
37
-        } elseif(is_resource($dataType)) {
37
+        } elseif (is_resource($dataType)) {
38 38
             return get_resource_type($dataType);
39 39
         } elseif (is_scalar($dataType)) {
40 40
             return $this->dumpScalar($dataType, $indent);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     }
102 102
 
103 103
 
104
-    private function iteratorToString(iterable $iterator, string $mask, int $indent, bool $isCompact=false):string
104
+    private function iteratorToString(iterable $iterator, string $mask, int $indent, bool $isCompact = false):string
105 105
     {
106 106
         $pairs = [];
107 107
         foreach ($iterator as $key => $value) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         if (is_array($subject) || $subject instanceof \ArrayIterator) {
134 134
             $max = count($subject);
135 135
             $objectAsArray = is_array($subject) ? $subject : $subject->getArrayCopy();
136
-            if(array_keys($objectAsArray) !== range(0, $max-1)) {
136
+            if (array_keys($objectAsArray) !== range(0, $max - 1)) {
137 137
                 $pairs = $objectAsArray;
138 138
             } else {
139 139
                 $valuesList = [];
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function __construct(int $options = null)
27 27
     {
28
-        if (is_int($options)) $this->options = $options;
28
+        if (is_int($options)) {
29
+            $this->options = $options;
30
+        }
29 31
     }
30 32
 
31 33
 
@@ -45,8 +47,12 @@  discard block
 block discarded – undo
45 47
 
46 48
     public function dumpScalar($dataType, $indent):string
47 49
     {
48
-        if ($dataType === \INF) return '.inf';
49
-        if ($dataType === -\INF) return '-.inf';
50
+        if ($dataType === \INF) {
51
+            return '.inf';
52
+        }
53
+        if ($dataType === -\INF) {
54
+            return '-.inf';
55
+        }
50 56
         $precision = "%.".$this->floatPrecision."F";
51 57
         switch (gettype($dataType)) {
52 58
             case 'boolean': return $dataType ? 'true' : 'false';
@@ -73,11 +79,19 @@  discard block
 block discarded – undo
73 79
                 }
74 80
             }
75 81
         } elseif (is_object($compound)) {
76
-            if ($compound instanceof YamlObject) return $this->dumpYamlObject($compound);
77
-            if ($compound instanceof Tagged)     return $this->dumpTagged($compound, $indent);
78
-            if ($compound instanceof Compact)    return $this->dumpCompact($compound, $indent);
82
+            if ($compound instanceof YamlObject) {
83
+                return $this->dumpYamlObject($compound);
84
+            }
85
+            if ($compound instanceof Tagged) {
86
+                return $this->dumpTagged($compound, $indent);
87
+            }
88
+            if ($compound instanceof Compact) {
89
+                return $this->dumpCompact($compound, $indent);
90
+            }
79 91
             //TODO:  consider dumping datetime as date strings according to a format provided by user
80
-            if ($compound instanceof \DateTime)  return $compound->format(self::DATE_FORMAT);
92
+            if ($compound instanceof \DateTime) {
93
+                return $compound->format(self::DATE_FORMAT);
94
+            }
81 95
             $iterator = new \ArrayIterator($compound);
82 96
         }
83 97
         return $this->iteratorToString($iterator, $mask, $indent);
Please login to merge, or discard this patch.
sources/Dumper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
         $dumpHandler = new DumperHandlers($options);
50 50
         if (is_scalar($dataType)) {
51 51
             // TODO: what to woth comments ???
52
-            return "--- ".$dumpHandler->dumpScalar($dataType, 0). self::LINEFEED ;
52
+            return "--- ".$dumpHandler->dumpScalar($dataType, 0).self::LINEFEED;
53 53
         }
54 54
         return $dumpHandler->dump($dataType, 0);
55 55
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@
 block discarded – undo
44 44
      */
45 45
     public static function toString($dataType, int $options = null):string
46 46
     {
47
-        if (empty($dataType)) throw new \Exception(self::class.": No content to convert to Yaml");
47
+        if (empty($dataType)) {
48
+            throw new \Exception(self::class.": No content to convert to Yaml");
49
+        }
48 50
         self::$options = is_int($options) ? $options : self::OPTIONS;
49 51
         $dumpHandler = new DumperHandlers($options);
50 52
         if (is_scalar($dataType)) {
Please login to merge, or discard this patch.
sources/nodes/CompactMapping.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(trim($nodeString), 1,-1)), $matches);
16
+        preg_match_all(Regex::MAPPING_VALUES, trim(substr(trim($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.
sources/nodes/Comment.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 block discarded – undo
10 10
  */
11 11
 class Comment extends NodeGeneric
12 12
 {
13
-   public function specialProcess(NodeGeneric &$previous, array &$emptyLines):bool
14
-   {
13
+    public function specialProcess(NodeGeneric &$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
         return null;
25
-   }
25
+    }
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
sources/nodes/DocStart.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
             throw new \Exception(__METHOD__." expects a YamlObject as parent", 1);
39 39
         }
40 40
         if (!is_null($this->value)) {
41
-            if ($this->value instanceof Tag){
41
+            if ($this->value instanceof Tag) {
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/CompactSequence.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public function __construct(string $nodeString, int $line)
19 19
     {
20 20
         parent::__construct($nodeString, $line);
21
-        preg_match_all(Regex::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1,-1)), $matches);
21
+        preg_match_all(Regex::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1, -1)), $matches);
22 22
         foreach ($matches['item'] as $key => $item) {
23 23
             $i = new Item('', $line);
24 24
             $i->indent = null;
Please login to merge, or discard this patch.
sources/nodes/Scalar.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
     public function getTargetOnLessIndent(NodeGeneric &$node):NodeGeneric
50 50
     {
51
-        if ($node instanceof Scalar || $node instanceof Blank ) {
51
+        if ($node instanceof Scalar || $node instanceof Blank) {
52 52
             return $this->getParent();
53 53
         } else {
54 54
             return $this->getParent($node->indent);
Please login to merge, or discard this patch.
sources/nodes/abstract/Literals.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         if (is_null($this->value)) $this->value = new NodeList();
36 36
         $candidate = $child;
37
-        if (!$child->isOneOf( ['Scalar', 'Blank', 'Comment', 'Quoted'])) {
37
+        if (!$child->isOneOf(['Scalar', 'Blank', 'Comment', 'Quoted'])) {
38 38
             $candidate = new Scalar((string) $child->raw, $child->line);
39 39
         }
40 40
         return parent::add($candidate);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * @return     string  The child value.
95 95
      * @todo       double check behaviour for KEY and ITEM
96 96
      */
97
-    protected function getChildValue(object $child, $refIndent=0):string
97
+    protected function getChildValue(object $child, $refIndent = 0):string
98 98
     {
99 99
         $value = $child->value;
100 100
         $start = '';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@
 block discarded – undo
32 32
 
33 33
     public function add(NodeGeneric $child):NodeGeneric
34 34
     {
35
-        if (is_null($this->value)) $this->value = new NodeList();
35
+        if (is_null($this->value)) {
36
+            $this->value = new NodeList();
37
+        }
36 38
         $candidate = $child;
37 39
         if (!$child->isOneOf( ['Scalar', 'Blank', 'Comment', 'Quoted'])) {
38 40
             $candidate = new Scalar((string) $child->raw, $child->line);
Please login to merge, or discard this patch.
sources/nodes/abstract/NodeGeneric.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         return false;
154 154
     }
155 155
 
156
-   /**
156
+    /**
157 157
      * Find parent target when current Node indentation is lesser than previous node indentation
158 158
      *
159 159
      * @param NodeGeneric $node
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         return $this->getParent();
190 190
     }
191 191
 
192
-   /**
192
+    /**
193 193
      * Find parent target when current Node indentation is superior than previous node indentation
194 194
      *
195 195
      * @param NodeGeneric $node
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function getParent(int $indent = null):NodeGeneric
73 73
     {
74
-        if (!is_int($indent)){
74
+        if (!is_int($indent)) {
75 75
             if ($this->_parent instanceof NodeGeneric) {
76 76
                 return $this->_parent;
77 77
             } else {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         if ($this->tag)        $props['tag']        = "($this->tag)";
246 246
         if ($this->value)      $props['value']      = $this->value;
247 247
         // $props['value'] = $this->value;
248
-        $props['raw']   = $this->raw;
248
+        $props['raw'] = $this->raw;
249 249
         if (!$this->_parent)  $props['parent'] = 'NO PARENT!!!';
250 250
         return $props;
251 251
     }
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -226,7 +226,9 @@  discard block
 block discarded – undo
226 226
     {
227 227
         foreach ($comparison as $className) {
228 228
             $fqn = __NAMESPACE__."\\$className";
229
-            if ($this instanceof $fqn) return true;
229
+            if ($this instanceof $fqn) {
230
+                return true;
231
+            }
230 232
         }
231 233
         return false;
232 234
     }
@@ -240,13 +242,23 @@  discard block
 block discarded – undo
240 242
     {
241 243
         $props = [];
242 244
         $props['line->indent'] = "$this->line -> $this->indent";
243
-        if ($this->identifier) $props['identifier'] = "($this->identifier)";
244
-        if ($this->anchor)     $props['anchor']     = "($this->anchor)";
245
-        if ($this->tag)        $props['tag']        = "($this->tag)";
246
-        if ($this->value)      $props['value']      = $this->value;
245
+        if ($this->identifier) {
246
+            $props['identifier'] = "($this->identifier)";
247
+        }
248
+        if ($this->anchor) {
249
+            $props['anchor']     = "($this->anchor)";
250
+        }
251
+        if ($this->tag) {
252
+            $props['tag']        = "($this->tag)";
253
+        }
254
+        if ($this->value) {
255
+            $props['value']      = $this->value;
256
+        }
247 257
         // $props['value'] = $this->value;
248 258
         $props['raw']   = $this->raw;
249
-        if (!$this->_parent)  $props['parent'] = 'NO PARENT!!!';
259
+        if (!$this->_parent) {
260
+            $props['parent'] = 'NO PARENT!!!';
261
+        }
250 262
         return $props;
251 263
     }
252 264
 }
Please login to merge, or discard this patch.