DateTime
6 months ago
Number
6 months ago
String
1 month ago
BooleanValueObject.php
6 months ago
Discount.php
6 months ago
DiscountFixedValue.php
2 months ago
DiscountPercentageValue.php
6 months ago
Duration.php
7 years ago
Gender.php
1 year ago
GeoTag.php
7 years ago
Json.php
6 months ago
Picture.php
1 year ago
PositiveDuration.php
7 years ago
Priority.php
6 months ago
Recurring.php
4 years ago
Duration.php
42 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Domain\ValueObjects; |
| 4 | |
| 5 | use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException; |
| 6 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\WholeNumber; |
| 7 | |
| 8 | /** |
| 9 | * Class Duration |
| 10 | * |
| 11 | * @package AmeliaBooking\Domain\ValueObjects |
| 12 | */ |
| 13 | final class Duration |
| 14 | { |
| 15 | /** |
| 16 | * @var WholeNumber |
| 17 | */ |
| 18 | private $duration; |
| 19 | |
| 20 | |
| 21 | /** |
| 22 | * Duration constructor. |
| 23 | * |
| 24 | * @param $duration |
| 25 | * |
| 26 | * @throws InvalidArgumentException |
| 27 | */ |
| 28 | public function __construct( |
| 29 | $duration |
| 30 | ) { |
| 31 | $this->duration = new WholeNumber($duration); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * @return int |
| 36 | */ |
| 37 | public function getValue() |
| 38 | { |
| 39 | return $this->duration->getValue(); |
| 40 | } |
| 41 | } |
| 42 |