Completed
Push — master ( c45521...844759 )
by stéphane
08:22
created

NodeRaw   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 7

1 Method

Rating   Name   Duplication   Size   Complexity  
B buildRaw() 0 21 7
1
<?php
2
3
namespace Dallgoot\Yaml;
4
5
/**
6
 *
7
 * @author  Stéphane Rebai <[email protected]>
8
 * @license Apache 2.0
9
 * @link    TODO : url to specific online doc
10
 */
11
class NodeRaw extends NodeLiterals
12
{
13
    public static function buildRaw(NodeList &$list):string
14
    {
15
        $result = '';
16
        if ($list->count()) {
17
            self::litteralStripTrailing($list);
18
            $first = $list->shift();
19
            $refIndent = $first->indent ?? 0;
20
            $result = substr($first->raw, $first->indent);
21
            foreach ($list as $key => $child) {
22
                if ($child->value instanceof NodeList) {
23
                    $val = parent::buildLitt($child->value);
0 ignored issues
show
Bug introduced by
The method buildLitt() does not exist on Dallgoot\Yaml\NodeLiterals. Did you maybe mean buildLitteral()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
                    /** @scrutinizer ignore-call */ 
24
                    $val = parent::buildLitt($child->value);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
24
                } else {
25
                    if ($child instanceof NodeComment && !$child->identifier) {
26
                        Builder::$_root->addComment($child->line, $child->value);
27
                    }
28
                    $val = $child instanceof NodeBlank ? "" : substr($child->raw, $refIndent);
29
                }
30
                $result .= $val;
31
            }
32
        }
33
        return $result;
34
    }
35
}