Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| LocalDate | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| getDateFormat | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isStrictFormat | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\DateValueObjects; |
| 3 | |
| 4 | use Apie\DateValueObjects\Concerns\CanCreateInstanceFromDateTimeObject; |
| 5 | use Apie\DateValueObjects\Concerns\CanHaveDayIntervals; |
| 6 | use Apie\DateValueObjects\Concerns\CanHaveMonthIntervals; |
| 7 | use Apie\DateValueObjects\Concerns\CanHaveYearIntervals; |
| 8 | use Apie\DateValueObjects\Concerns\IsDateValueObject; |
| 9 | use Apie\DateValueObjects\Interfaces\WorksWithDays; |
| 10 | use Apie\DateValueObjects\Interfaces\WorksWithMonths; |
| 11 | use Apie\DateValueObjects\Interfaces\WorksWithYears; |
| 12 | |
| 13 | /** |
| 14 | * Represents a date only. |
| 15 | * |
| 16 | * For example "2022-12-25" is 25 december 2022. |
| 17 | * |
| 18 | * One notice is that months and day lower than 0 need to be prefixed with '0' just as |
| 19 | * what an <input type="date"> would send.' |
| 20 | * |
| 21 | * For example: '2012-28-01" for 28 january 2012 and not '2012-28-1' |
| 22 | */ |
| 23 | final class LocalDate implements WorksWithDays, WorksWithMonths, WorksWithYears |
| 24 | { |
| 25 | use CanCreateInstanceFromDateTimeObject; |
| 26 | use CanHaveDayIntervals; |
| 27 | use CanHaveMonthIntervals; |
| 28 | use CanHaveYearIntervals; |
| 29 | use IsDateValueObject; |
| 30 | |
| 31 | public static function getDateFormat(): string |
| 32 | { |
| 33 | return 'Y-m-d'; |
| 34 | } |
| 35 | |
| 36 | protected function isStrictFormat(): bool |
| 37 | { |
| 38 | return true; |
| 39 | } |
| 40 | } |