Completed
Pull Request — master (#345)
by
unknown
05:39
created

DayOfWeek::fromUdb3ModelDay()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace CultuurNet\UDB3\Calendar;
4
5
use CultuurNet\UDB3\Model\ValueObject\Calendar\OpeningHours\Day;
6
use ValueObjects\Enum\Enum;
7
8
/**
9
 * Created custom value object instead of using WeekDay to avoid changing
10
 * casing of the first letter.
11
 *
12
 * @method static DayOfWeek MONDAY()
13
 * @method static DayOfWeek TUESDAY()
14
 * @method static DayOfWeek WEDNESDAY()
15
 * @method static DayOfWeek THURSDAY()
16
 * @method static DayOfWeek FRIDAY()
17
 * @method static DayOfWeek SATURDAY()
18
 * @method static DayOfWeek SUNDAY()
19
 *
20
 * @todo Replace by CultuurNet\UDB3\Model\ValueObject\Calendar\OpeningHours\Day.
21
 */
22
class DayOfWeek extends Enum
23
{
24
    const MONDAY = 'monday';
25
    const TUESDAY = 'tuesday';
26
    const WEDNESDAY = 'wednesday';
27
    const THURSDAY = 'thursday';
28
    const FRIDAY = 'friday';
29
    const SATURDAY = 'saturday';
30
    const SUNDAY = 'sunday';
31
32
    /**
33
     * @param Day $day
34
     * @return DayOfWeek
35
     */
36
    public static function fromUdb3ModelDay(Day $day)
37
    {
38
        return self::fromNative($day->toString());
39
    }
40
}
41