Blank   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 94.12%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 35
ccs 16
cts 17
cp 0.9412
rs 10
c 0
b 0
f 0
wmc 8

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getTargetOnEqualIndent() 0 3 1
A specialProcess() 0 9 3
A add() 0 6 2
A getTargetOnMoreIndent() 0 3 1
A build() 0 3 1
1
<?php
2
3
namespace Dallgoot\Yaml\Nodes;
4
5
use Dallgoot\Yaml\Nodes\Generic\NodeGeneric;
6
use Dallgoot\Yaml\Nodes\Generic\Literals;
7
8
/**
9
 *
10
 * @author  Stéphane Rebai <[email protected]>
11
 * @license Apache 2.0
12
 * @link    https://github.com/dallgoot/yaml
13
 */
14
class Blank extends NodeGeneric
15
{
16 1
    public function add(NodeGeneric $child): NodeGeneric
17
    {
18 1
        if ($this->_parent instanceof NodeGeneric) {
19 1
            return $this->_parent->add($child);
20
        } else {
21
            throw new \ParseError(__METHOD__ . " no parent to add to", 1);
22
        }
23
    }
24
25 1
    public function specialProcess(NodeGeneric &$previous, array &$emptyLines): bool
26
    {
27 1
        $deepest = $previous->getDeepestNode();
28 1
        if ($previous instanceof Scalar) {
29 1
            $emptyLines[] = $this->setParent($previous->getParent());
30 1
        } elseif ($deepest instanceof Literals) {
31 1
            $emptyLines[] = $this->setParent($deepest);
32
        }
33 1
        return true;
34
    }
35
36 1
    public function build(&$parent = null)
37
    {
38 1
        return "\n";
39
    }
40
41 1
    public function getTargetOnEqualIndent(NodeGeneric &$node): ?NodeGeneric
42
    {
43 1
        return $this->getParent($node->indent);
44
    }
45
46 1
    public function getTargetOnMoreIndent(NodeGeneric &$node): ?NodeGeneric
47
    {
48 1
        return $this->getParent($node->indent);
49
    }
50
}
51