diff --git a/src/Contracts/HasTypeIDWithAmount.php b/src/Contracts/HasTypeIDWithAmount.php new file mode 100644 index 00000000..5d46d9d8 --- /dev/null +++ b/src/Contracts/HasTypeIDWithAmount.php @@ -0,0 +1,35 @@ +amount = $amount; + } + + /** + * @return int The amount of items + */ + public function getAmount(): int + { + return $this->amount; + } +} diff --git a/src/Items/PriceableEveType.php b/src/Items/PriceableEveType.php index dbe6b95b..6d00de93 100644 --- a/src/Items/PriceableEveType.php +++ b/src/Items/PriceableEveType.php @@ -28,28 +28,18 @@ /** * A basic implementation od IPriceable. */ -class PriceableEveType extends EveType implements IPriceable +class PriceableEveType extends EveTypeWithAmount implements IPriceable { protected float $price; - protected float $amount; /** * @param int|HasTypeID $type_id The eve type to be appraised - * @param float $amount The amount of this type to be appraised + * @param float|int $amount The amount of this type to be appraised */ - public function __construct(int|HasTypeID $type_id, float $amount) + public function __construct(int|HasTypeID $type_id, float|int $amount) { - parent::__construct($type_id); + parent::__construct($type_id, (int) $amount); $this->price = 0; - $this->amount = $amount; - } - - /** - * @return int The amount of this item to be appraised - */ - public function getAmount(): int - { - return $this->amount; } /**