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::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 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