NodeTrait::setParentNode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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