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.

DateTimeInterval   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 70
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 2
A getStart() 0 4 1
A getEnd() 0 4 1
A jsonSerialize() 0 7 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Speicher210\BusinessHours;
6
7
/**
8
 * Represents a date and time interval.
9
 */
10
class DateTimeInterval implements \JsonSerializable
11
{
12
    /**
13
     * The start date and time.
14
     *
15
     * @var \DateTime
16
     */
17
    private $start;
18
19
    /**
20
     * The end date and time.
21
     *
22
     * @var \DateTime
23
     */
24
    private $end;
25
26
    /**
27
     * Creates a date and time interval.
28
     *
29
     * @param \DateTime $start The starting date and time.
30
     * @param \DateTime $end The ending date and time.
31 51
     * @throws \InvalidArgumentException If the opening date and time is not earlier than closing date and time.
32
     */
33 51
    public function __construct(\DateTime $start, \DateTime $end)
34 51
    {
35
        $this->start = $start;
36 51
        $this->end = $end;
37 6
38 6
        if ($end <= $start) {
39 6
            throw new \InvalidArgumentException(
40 6
                \sprintf(
41 6
                    'The opening date and time "%s" must be before the closing date and time "%s".',
42 6
                    $start->format('Y-m-d H:i:s'),
43 6
                    $end->format('Y-m-d H:i:s')
44
                )
45 45
            );
46
        }
47
    }
48
49
    /**
50
     * Get the start date and time.
51
     *
52 27
     * @return \DateTime
53
     */
54 27
    public function getStart(): \DateTime
55
    {
56
        return $this->start;
57
    }
58
59
    /**
60
     * Get the end date and time.
61
     *
62 27
     * @return \DateTime
63
     */
64 27
    public function getEnd(): \DateTime
65
    {
66
        return $this->end;
67
    }
68
69
    /**
70 3
     * {@inheritdoc}
71
     */
72
    public function jsonSerialize()
73 3
    {
74 3
        return [
75 3
            'start' => $this->start,
76
            'end' => $this->end,
77
        ];
78
    }
79
}
80