vaened /
laravel-searcher
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Created by enea dhack - 23/11/2019 18:35. |
||
| 4 | */ |
||
| 5 | |||
| 6 | namespace Vaened\Searcher\Dates; |
||
| 7 | |||
| 8 | use Carbon\Carbon; |
||
| 9 | use Vaened\Enum\Enum; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Class Format |
||
| 13 | * |
||
| 14 | * @package Components\Dates |
||
| 15 | * @author enea dhack <[email protected]> |
||
| 16 | * |
||
| 17 | * @method static Format YMD() |
||
| 18 | * @method static Format YMD_HIS() |
||
| 19 | * @method static Format YMD_HIA() |
||
| 20 | * @method static Format DMY() |
||
| 21 | * @method static Format DMY_HIS() |
||
| 22 | * @method static Format DMY_HIA() |
||
| 23 | * @method static Format HIS() |
||
| 24 | * @method static Format HIA() |
||
| 25 | */ |
||
| 26 | class Format extends Enum |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 27 | { |
||
| 28 | public const YMD = 'Y-m-d'; |
||
| 29 | |||
| 30 | public const YMD_HIS = 'Y-m-d H:i:s'; |
||
| 31 | |||
| 32 | public const YMD_HIA = 'Y-m-d H:i A'; |
||
| 33 | |||
| 34 | public const DMY = 'd-m-Y'; |
||
| 35 | |||
| 36 | public const DMY_HIS = 'd-m-Y H:i:s'; |
||
| 37 | |||
| 38 | public const DMY_HIA = 'd-m-Y H:i A'; |
||
| 39 | |||
| 40 | public const HIS = 'H:i:s'; |
||
| 41 | |||
| 42 | public const HIA = 'H:i A'; |
||
| 43 | |||
| 44 | public function apply(Carbon $date): string |
||
| 45 | { |
||
| 46 | return $date->format($this->value()); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |