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 ( 5bf78a...a34534 )
by Ariel
03:47
created

ICalEvent::getEnd()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Timegridio\ICalReader;
4
5
use Carbon\Carbon;
6
7
class ICalEvent
8
{
9
    private $start;
10
11
    private $end;
12
13
    private $busy = true;
14
15
    public function __construct($data, $timezone)
16
    {
17
        $this->init($data, $timezone);
18
    }
19
20
    protected function init($data, $timezone)
21
    {
22
        $this->setStart(
23
            array_get($data, 'DTSTART'),
24
            $timezone
25
            );
26
27
        $this->setEnd(
28
            array_get($data, 'DTEND'),
29
            $timezone
30
            );
31
32
        $this->setBusy(
33
            array_get($data, 'SUMMARY')
34
            );
35
    }
36
37
    public function getStart()
38
    {
39
        return $this->start;
40
    }
41
42
    public function getEnd()
43
    {
44
        return $this->end;
45
    }
46
47
    protected function setStart($datetime, $timezone)
48
    {
49
        $this->start = $this->makeTimestamp($datetime, $timezone);
50
    }
51
52
    protected function setEnd($datetime, $timezone)
53
    {
54
        $this->end = $this->makeTimestamp($datetime, $timezone);
55
    }
56
57
    protected function makeTimestamp($datetime, $timezone)
58
    {
59
        return Carbon::parse($datetime)->timezone($timezone);
60
    }
61
62
    protected function setBusy($status)
63
    {
64
        $this->busy = (strtolower($status) != 'free');
65
    }
66
67
    public function isBusy()
68
    {
69
        return $this->busy;
70
    }
71
72
    public function holds(Carbon $atDatetime)
73
    {
74
        return $this->start->lt($atDatetime) && $this->end->gt($atDatetime);
75
    }
76
}
77