Total Complexity | 5 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
20 | class BoxList implements IteratorAggregate |
||
21 | { |
||
22 | /** |
||
23 | * @var Box[] |
||
24 | */ |
||
25 | private array $list = []; |
||
26 | |||
27 | private bool $isSorted = false; |
||
28 | |||
29 | 55 | public function __construct(private readonly BoxSorter $sorter = new DefaultBoxSorter()) |
|
31 | 55 | } |
|
32 | |||
33 | /** |
||
34 | * Do a bulk create. |
||
35 | * |
||
36 | * @param Box[] $boxes |
||
37 | */ |
||
38 | 2 | public static function fromArray(array $boxes, bool $preSorted = false): self |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return Traversable<Box> |
||
49 | */ |
||
50 | 54 | public function getIterator(): Traversable |
|
58 | } |
||
59 | |||
60 | 51 | public function insert(Box $item): void |
|
65 |