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.

TimeTable::getDays()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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