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
use IteratorAggregate;
6
7
/**
8
 * @implements IteratorAggregate<int, Node>
9
 */
10
class Result implements \Countable, \IteratorAggregate
11
{
12
    /**
13
     * @var int<0, max>
14
     */
15
    public int $count = 0;
16
17
    /**
18
     * @var Node[]
19
     */
20
    public array $items = [];
21
22 22
    public function count() : int
23
    {
24 22
        return max(0, $this->count);
25
    }
26
27 2
    public function getIterator() : \Traversable
28
    {
29 2
        return new \ArrayIterator($this->items);
30
    }
31
}
32