Total Complexity | 10 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
15 | class ItemList extends \SplMaxHeap |
||
16 | { |
||
17 | /** |
||
18 | * Compare elements in order to place them correctly in the heap while sifting up. |
||
19 | * |
||
20 | * @see \SplMaxHeap::compare() |
||
21 | * |
||
22 | * @param mixed $itemA |
||
23 | * @param mixed $itemB |
||
24 | * |
||
25 | * @return int |
||
26 | */ |
||
27 | 22 | public function compare($itemA, $itemB) |
|
39 | } |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Get copy of this list as a standard PHP array. |
||
44 | * |
||
45 | * @return Item[] |
||
46 | */ |
||
47 | 5 | public function asArray() |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * @internal |
||
59 | * |
||
60 | * @param int $n |
||
61 | * @return ItemList |
||
62 | */ |
||
63 | 12 | public function topN($n) |
|
76 |