Passed
Push — 2.x ( 0b5227...cb81b7 )
by butschster
16:17
created

EmbeddedNode::push()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
nc 2
nop 1
dl 0
loc 11
ccs 5
cts 6
cp 0.8333
crap 2.0185
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\ORM\Parser;
6
7
use Cycle\ORM\Exception\ParserException;
8
9
/**
10
 * @internal
11
 */
12
final class EmbeddedNode extends AbstractNode
13
{
14 264
    protected function push(array &$data): void
15
    {
16 264
        if ($this->parent === null) {
17
            throw new ParserException('Unable to register data tree, parent is missing');
18
        }
19
20 264
        $this->parent->mount(
21 264
            $this->container,
0 ignored issues
show
Bug introduced by
It seems like $this->container can also be of type null; however, parameter $container of Cycle\ORM\Parser\AbstractNode::mount() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

21
            /** @scrutinizer ignore-type */ $this->container,
Loading history...
22 264
            $this->indexName,
0 ignored issues
show
Bug introduced by
It seems like $this->indexName can also be of type null; however, parameter $index of Cycle\ORM\Parser\AbstractNode::mount() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

22
            /** @scrutinizer ignore-type */ $this->indexName,
Loading history...
23
            self::LAST_REFERENCE,
24
            $data
25
        );
26
    }
27
}
28