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.

OpeningHourChecker::isOpenAt()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 1
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 3
rs 9.9332
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Sourcebox\OpeningHours\Checker;
5
6
use Sourcebox\OpeningHours\Override\OverrideInterface;
7
8
/**
9
 * Class OpeningHourChecker
10
 * @package Sourcebox\TimeTable
11
 */
12
class OpeningHourChecker extends TimeTableChecker
13
{
14
    /**
15
     * Checks the time table whether there are opening time periods
16
     * for the given day.
17
     *
18
     * @param $dayId
19
     *
20
     * @return bool
21
     */
22 4
    public function isOpenOn($dayId) : bool
23
    {
24 4
        return count($this->getTimePeriodsForDay($dayId)) > 0;
25
    }
26
27
    /**
28
     * Checks the time table whether there are no opening time periods
29
     * for the given day.
30
     *
31
     * @param $dayName
32
     * @return bool
33
     */
34 2
    public function isClosedOn($dayName)
35
    {
36 2
        return !$this->isOpenOn($dayName);
37
    }
38
39
    /**
40
     * Checks time table for open time periods on a certain date and time.
41
     *
42
     * @param \DateTime $dateTime
43
     * @return bool
44
     */
45 44
    public function isOpenAt(\DateTime $dateTime) : bool
46
    {
47 44
        if ($this->isOverridden($dateTime, OverrideInterface::TYPE_EXCLUDE)) {
48 24
            return false;
49 22
        } elseif ($this->isOverridden($dateTime, OverrideInterface::TYPE_INCLUDE)) {
50 2
            return true;
51
        }
52
53 20
        return $this->isDateTimeWithinDayTimePeriods($dateTime);
54
    }
55
56
    /**
57
     * Checks time table if there are no open time periods on a certain date and time.
58
     * @param \DateTime $dateTime
59
     * @return bool
60
     */
61 14
    public function isClosedAt(\DateTime $dateTime) : bool
62
    {
63 14
        return !$this->isOpenAt($dateTime);
64
    }
65
}
66