Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package phpOMS\Algorithm\Knapsack |
| 8 | * @copyright Dennis Eichhorn |
| 9 | * @license OMS License 2.0 |
| 10 | * @version 1.0.0 |
| 11 | * @link https://jingga.app |
| 12 | */ |
| 13 | declare(strict_types=1); |
| 14 | |
| 15 | namespace phpOMS\Algorithm\Knapsack; |
| 16 | |
| 17 | /** |
| 18 | * Backpack interface. |
| 19 | * |
| 20 | * @package phpOMS\Algorithm\Knapsack; |
| 21 | * @license OMS License 2.0 |
| 22 | * @link https://jingga.app |
| 23 | * @since 1.0.0 |
| 24 | */ |
| 25 | interface BackpackInterface |
| 26 | { |
| 27 | /** |
| 28 | * Get the value of the stored items |
| 29 | * |
| 30 | * @return float |
| 31 | * |
| 32 | * @since 1.0.0 |
| 33 | */ |
| 34 | public function getValue() : float; |
| 35 | |
| 36 | /** |
| 37 | * Get the cost of the stored items |
| 38 | * |
| 39 | * @return float |
| 40 | * |
| 41 | * @since 1.0.0 |
| 42 | */ |
| 43 | public function getCost() : float; |
| 44 | |
| 45 | /** |
| 46 | * Get the max allowed costs for the items |
| 47 | * |
| 48 | * @return float |
| 49 | * |
| 50 | * @since 1.0.0 |
| 51 | */ |
| 52 | public function getMaxCost() : float; |
| 53 | |
| 54 | /** |
| 55 | * Get items |
| 56 | * |
| 57 | * @return array |
| 58 | * |
| 59 | * @since 1.0.0 |
| 60 | */ |
| 61 | public function getItems() : array; |
| 62 | |
| 63 | /** |
| 64 | * Add item to backpack |
| 65 | * |
| 66 | * @param ItemInterface $item Item |
| 67 | * @param int|float $quantity Quantity of the item |
| 68 | * |
| 69 | * @return void |
| 70 | * |
| 71 | * @since 1.0.0 |
| 72 | */ |
| 73 | public function addItem(ItemInterface $item, int | float $quantity = 1) : void; |
| 74 | } |