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.
Passed
Push — master ( 07b164...660df5 )
by Kristjan
36s
created

ArrayHolidayProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace COG\ChronoShifter\HolidayProvider;
4
5
/**
6
 * Simple holiday provider if all possible holidays can be known ahead of time.
7
 *
8
 * @author Kristjan Siimson <[email protected]>
9
 * @package HolidayProvider\Domain
10
 */
11
class ArrayHolidayProvider implements HolidayProvider
12
{
13
    /**
14
     * @var string[]
15
     */
16
    private $holidays;
17
18
    /**
19
     * @param string[] $holidays List of holidays each in YYYY-MM-DD format.
20
     */
21 36
    public function __construct(array $holidays = array())
22
    {
23 36
        $this->holidays = $holidays;
24 36
    }
25
26
    /**
27
     * @param \DateTime|string $date
28
     * @return bool
29
     */
30 34
    public function isHoliday($date)
31
    {
32 34
        return in_array(substr($date, 0, 10), $this->holidays);
33
    }
34
}
35