Result   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 3
b 0
f 0
dl 0
loc 20
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 3 1
A count() 0 3 1
1
<?php
2
3
namespace kalanis\nested_tree\Support;
4
5
/**
6
 * @implements \IteratorAggregate<int, Node>
7
 */
8
class Result implements \Countable, \IteratorAggregate
9
{
10
    /**
11
     * @var int<0, max>
12
     */
13
    public int $count = 0;
14
15
    /**
16
     * @var Node[]
17
     */
18
    public array $items = [];
19
20 29
    public function count() : int
21
    {
22 29
        return max(0, $this->count);
23
    }
24
25 2
    public function getIterator() : \Traversable
26
    {
27 2
        return new \ArrayIterator($this->items);
28
    }
29
}
30