Passed
Push — 1.x ( c44c8d...17a2f8 )
by Ulises Jeremias
02:44
created

Node::getValue()   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 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php namespace Mbh\Tree\Traits;
2
3
/**
4
 * MBHFramework
5
 *
6
 * @link      https://github.com/MBHFramework/mbh-framework
7
 * @copyright Copyright (c) 2017 Ulises Jeremias Cornejo Fandos
8
 * @license   https://github.com/MBHFramework/mbh-framework/blob/master/LICENSE (MIT License)
9
 */
10
11
trait Node
12
{
13
    /**
14
     * @var mixed
15
     */
16
    private $value;
17
18
    /**
19
     * parent
20
     *
21
     * @var NodeInterface
0 ignored issues
show
Bug introduced by
The type Mbh\Tree\Traits\NodeInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
     * @access private
23
     */
24
    private $parent;
25
26
    /**
27
     * @var NodeInterface[]
28
     */
29
    private $children = [];
30
31
    /**
32
     * @param mixed $value
33
     * @param NodeInterface[] $children
34
     */
35
    public function __construct($value = null, array $children = [])
36
    {
37
        $this->setValue($value);
38
        if (!empty($children)) {
39
            $this->setChildren($children);
0 ignored issues
show
Bug introduced by
It seems like setChildren() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

39
            $this->/** @scrutinizer ignore-call */ 
40
                   setChildren($children);
Loading history...
40
        }
41
    }
42
43
    /**
44
    * {@inheritdoc}
45
    */
46
    public function setValue($value)
47
    {
48
        $this->value = $value;
49
        return $this;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function getValue()
56
    {
57
        return $this->value;
58
    }
59
}
60