GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 7e6465...50bb24 )
by Kevin
02:32
created

TimeTable::getDays()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Sourcebox\OpeningHours;
4
5
/**
6
 * Class TimeTable
7
 * @package Sourcebox\OpeningHours
8
 */
9
class TimeTable
10
{
11
    /**
12
     * @var Day[]
13
     */
14
    private $days;
15
16
    /**
17
     * @var \DateTimeZone
18
     */
19
    private $timezone;
20
21
    /**
22
     * TimeTable constructor.
23
     * @param array $days
24
     * @param \DateTimeZone $timezone
25
     */
26 64
    public function __construct(array $days, \DateTimeZone $timezone = null)
27
    {
28 64
        if (!$timezone) {
29 28
            $timezone = new \DateTimeZone(date_default_timezone_get());
30
        }
31
32 64
        $this->timezone = $timezone;
33 64
        $this->setDays($days);
34 64
    }
35
36
    /**
37
     * @return Day[]
38
     */
39 2
    public function getDays(): array
40
    {
41 2
        return $this->days;
42
    }
43
44
    /**
45
     * @param Day[] $days
46
     *
47
     * @return TimeTable
48
     */
49 64
    public function setDays(array $days): TimeTable
50
    {
51 64
        foreach ($days as $day) {
52 54
            $this->days[$day->getNumber()] = $day;
53
        }
54
55 64
        return $this;
56
    }
57
58
    /**
59
     * @param int|string $name
60
     * @return null|Day
61
     */
62 26
    public function getDay(int $name)
63
    {
64 26
        if (array_key_exists($name, $this->days)) {
65 24
            return $this->days[$name];
66
        }
67
68 8
        return null;
69
    }
70
71
    /**
72
     * @return \DateTimeZone
73
     */
74 22
    public function getTimezone(): \DateTimeZone
75
    {
76 22
        return $this->timezone;
77
    }
78
79
    /**
80
     * @param \DateTimeZone $timezone
81
     *
82
     * @return TimeTable
83
     */
84 2
    public function setTimezone(\DateTimeZone $timezone): TimeTable
85
    {
86 2
        $this->timezone = $timezone;
87
88 2
        return $this;
89
    }
90
}
91