Passed
Push — master ( 0a4fc8...34ac19 )
by Anton
04:11
created

EmbeddedNode   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A push() 0 11 2
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license   MIT
6
 * @author    Anton Titov (Wolfy-J)
7
 */
8
declare(strict_types=1);
9
10
namespace Cycle\ORM\Parser;
11
12
use Cycle\ORM\Exception\ParserException;
13
14
/**
15
 * @internal
16
 */
17
final class EmbeddedNode extends AbstractNode
18
{
19
    /**
20
     * @param array $data
21
     */
22
    protected function push(array &$data)
23
    {
24
        if (empty($this->parent)) {
25
            throw new ParserException("Unable to register data tree, parent is missing");
26
        }
27
28
        $this->parent->mount(
29
            $this->container,
30
            $this->outerKey,
0 ignored issues
show
Bug introduced by
It seems like $this->outerKey can also be of type null; however, parameter $key 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

30
            /** @scrutinizer ignore-type */ $this->outerKey,
Loading history...
31
            self::LAST_REFERENCE,
32
            $data
33
        );
34
    }
35
}