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

OpeningHourChecker   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 54
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

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