| Total Complexity | 6 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | class BoxList implements IteratorAggregate |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * List containing boxes. |
||
| 25 | * |
||
| 26 | * @var Box[] |
||
| 27 | */ |
||
| 28 | private $list = []; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Has this list already been sorted? |
||
| 32 | * |
||
| 33 | * @var bool |
||
| 34 | */ |
||
| 35 | private $isSorted = false; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var BoxSorter |
||
| 39 | */ |
||
| 40 | private $sorter; |
||
| 41 | |||
| 42 | 48 | public function __construct(?BoxSorter $sorter = null) |
|
| 45 | 48 | } |
|
| 46 | |||
| 47 | /** |
||
| 48 | * Do a bulk create. |
||
| 49 | * |
||
| 50 | * @param Box[] $boxes |
||
| 51 | * |
||
| 52 | * @return BoxList |
||
| 53 | */ |
||
| 54 | 2 | public static function fromArray(array $boxes, bool $preSorted = false): self |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return Traversable|Box[] |
||
| 65 | */ |
||
| 66 | 47 | public function getIterator(): Traversable |
|
| 74 | } |
||
| 75 | |||
| 76 | 44 | public function insert(Box $item): void |
|
| 81 |