Partial   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 32
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A specialProcess() 0 17 4
A build() 0 3 1
1
<?php
2
3
namespace Dallgoot\Yaml\Nodes;
4
5
use Dallgoot\Yaml\NodeFactory;
6
use Dallgoot\Yaml\Nodes\Generic\NodeGeneric;
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 Partial extends NodeGeneric
15
{
16
    /**
17
     * What first character to determine if escaped sequence are allowed
18
     *
19
     * @param      NodeGeneric     $current     The current
20
     * @param      array    $emptyLines  The empty lines
21
     *
22
     * @return     boolean  true to skip normal Loader process, false to continue
23
     */
24 3
    public function specialProcess(NodeGeneric &$current, array &$emptyLines): bool
25
    {
26 3
        $parent = $this->getParent();
27 3
        $addValue = ltrim($current->raw);
28 3
        $separator = ' ';
29 3
        if ($this->raw[-1] === ' ' || $this->raw[-1] === "\n") {
30 1
            $separator = '';
31
        }
32 3
        if ($current instanceof Blank) {
33 1
            $addValue = "\n";
34 1
            $separator = '';
35
        }
36 3
        $node = NodeFactory::get($this->raw . $separator . $addValue, $this->line);
37 3
        $node->indent = null;
38 3
        $parent->value = null;
39 3
        $parent->add($node);
40 3
        return true;
41
    }
42
43 1
    public function build(&$parent = null)
44
    {
45 1
        throw new \ParseError("Partial value found at line $this->line", 1);
46
    }
47
}
48