Passed
Push — master ( f5a50b...6ba131 )
by Andy
01:39
created

AbstractPeriod::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Palmtree\Chrono\Option;
4
5
abstract class AbstractPeriod
6
{
7
    abstract protected static function getIntervalCodes(): array;
8
9
    abstract protected static function getDateFormats(): array;
10
11 4
    public static function getIntervalCode(string $period): string
12
    {
13 4
        return static::getIntervalCodes()[$period];
14
    }
15
16 12
    public static function getDateFormat(string $period): string
17
    {
18 12
        return static::getDateFormats()[$period];
19
    }
20
21
    public static function toArray(): array
22
    {
23
        return array_keys(static::getIntervalCodes());
24
    }
25
}
26