Completed
Push — master ( ceee37...536973 )
by Enea
02:33
created

Format   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
dl 0
loc 21
rs 10
c 1
b 0
f 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 0 3 1
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
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