Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ItemReward | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AqwSocketClient\Objects\Quest; |
| 6 | |
| 7 | use AqwSocketClient\Objects\Identifiers\ItemIdentifier; |
| 8 | use Psl; |
| 9 | use Psl\Type; |
| 10 | |
| 11 | final readonly class ItemReward implements QuestRewardInterface |
| 12 | { |
| 13 | public function __construct( |
| 14 | public readonly ItemIdentifier $itemIdentifier, |
| 15 | public readonly int $rate, |
| 16 | public readonly int $quantity, |
| 17 | ) { |
| 18 | Psl\invariant($this->rate >= 1 && $this->rate <= 100, 'Rate must be between 1 and 100, got %d.', $this->rate); |
| 19 | Type\positive_int()->assert($this->quantity); |
| 20 | } |
| 21 | } |