| 1 | <?php |
||
| 16 | class BoxList implements \Countable, \IteratorAggregate |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | protected $list = []; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var bool |
||
| 25 | */ |
||
| 26 | protected $isSorted = true; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @return int |
||
| 30 | */ |
||
| 31 | public function count() |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return \ArrayIterator |
||
| 38 | */ |
||
| 39 | 21 | public function getIterator() |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Insert a box choice into the list |
||
| 47 | * |
||
| 48 | * @param Box $box |
||
| 49 | */ |
||
| 50 | 20 | public function insert(Box $box) |
|
| 55 | |||
| 56 | /** |
||
| 57 | * Sort the boxes into order (smallest volume first) |
||
| 58 | */ |
||
| 59 | 21 | protected function sort() |
|
| 77 | } |
||
| 78 |