Completed
Push — develop ( 67e161...8b0772 )
by Paul
05:50
created

NodeTrait::setParentNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PhpUnitGen\Model\PropertyTrait;
4
5
use PhpUnitGen\Model\PropertyInterface\NodeInterface;
6
7
/**
8
 * Trait NodeTrait.
9
 *
10
 * @author     Paul Thébaud <[email protected]>.
11
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
12
 * @license    https://opensource.org/licenses/MIT The MIT license.
13
 * @link       https://github.com/paul-thebaud/phpunit-generator
14
 * @since      Class available since Release 2.0.0.
15
 */
16
trait NodeTrait
17
{
18
    /**
19
     * @var NodeInterface|null $parentNode The node parent.
20
     */
21
    protected $parentNode;
22
23
    /**
24
     * @param NodeInterface|null $parentNode The new parent node to set.
25
     */
26
    public function setParentNode(?NodeInterface $parentNode): void
27
    {
28
        $this->parentNode = $parentNode;
29
    }
30
31
    /**
32
     * @return NodeInterface|null The parent node if it exists.
33
     */
34
    public function getParentNode(): ?NodeInterface
35
    {
36
        return $this->parentNode;
37
    }
38
}
39