ReadonlyNodeTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
c 3
b 0
f 0
lcom 1
cbo 3
dl 0
loc 25
rs 10
1
<?php
2
3
namespace Nayjest\Tree;
4
5
use Nayjest\Collection\Decorator\ReadonlyObjectCollection;
6
7
trait ReadonlyNodeTrait
8
{
9
    use ChildNodeTrait;
10
    use ParentNodeTrait {
11
        ParentNodeTrait::children as protected writableChildren;
12
    }
13
14
    private $readonlyCollection;
15
16
    /**
17
     * Returns child components.
18
     *
19
     * @return ReadonlyObjectCollection
20
     */
21
    public function children()
22
    {
23
        if ($this->readonlyCollection === null) {
24
            $this->readonlyCollection = new ReadonlyObjectCollection(
25
                $this->writableChildren()
0 ignored issues
show
Bug introduced by
The method writableChildren() does not exist on Nayjest\Tree\ReadonlyNodeTrait. Did you maybe mean children()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
26
            );
27
        }
28
29
        return $this->readonlyCollection;
30
    }
31
}
32