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   A
last analyzed

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
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