Completed
Push — master ( 3eacba...3b6a73 )
by stéphane
02:25
created

NodeAnchor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 10
dl 0
loc 18
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isAwaitingChild() 0 3 1
A build() 0 10 2
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 NodeAnchor extends NodeActions
12
{
13 1
    public function build(&$parent = null)
14
    {
15 1
        $name = substr($this->anchor, 1);
16 1
        $yamlObject = $this->getRoot()->getYamlObject();
0 ignored issues
show
Bug introduced by
The method getYamlObject() does not exist on Dallgoot\Yaml\NodeAnchor. ( Ignorable by Annotation )

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

16
        $yamlObject = $this->getRoot()->/** @scrutinizer ignore-call */ getYamlObject();

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...
17 1
        if ($this->anchor[0] === "*") {
18 1
            return $yamlObject->getReference($name);
19
        } else {
20 1
            $built = $this->value->build($parent);
0 ignored issues
show
Bug introduced by
The method build() does not exist on null. ( Ignorable by Annotation )

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

20
            /** @scrutinizer ignore-call */ 
21
            $built = $this->value->build($parent);

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...
21 1
            $yamlObject->addReference($name, $built);
22 1
            return $built;
23
        }
24
    }
25
26 1
    public function isAwaitingChild(Node $node):bool
27
    {
28 1
        return is_null($this->value);
29
    }
30
}