UnitAvailabilityCalendar::setAvailableForArrival()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 5
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Gueststream\PMS\IQWare\API;
4
5 View Code Duplication
class UnitAvailabilityCalendar
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
8
    /**
9
     * @var \DateTime $CalendarDate
10
     */
11
    protected $CalendarDate = null;
12
13
    /**
14
     * @var boolean $AvailableForArrival
15
     */
16
    protected $AvailableForArrival = null;
17
18
    /**
19
     * @var boolean $AvailableForDeparture
20
     */
21
    protected $AvailableForDeparture = null;
22
23
    /**
24
     * @param \DateTime $CalendarDate
25
     * @param boolean $AvailableForArrival
26
     * @param boolean $AvailableForDeparture
27
     */
28
    public function __construct(\DateTime $CalendarDate, $AvailableForArrival, $AvailableForDeparture)
29
    {
30
        $this->CalendarDate = $CalendarDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $CalendarDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $CalendarDate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
31
        $this->AvailableForArrival = $AvailableForArrival;
32
        $this->AvailableForDeparture = $AvailableForDeparture;
33
    }
34
35
    /**
36
     * @return \DateTime
37
     */
38
    public function getCalendarDate()
39
    {
40
        if ($this->CalendarDate == null) {
41
            return null;
42
        } else {
43
            try {
44
                return new \DateTime($this->CalendarDate);
45
            } catch (\Exception $e) {
46
                return false;
47
            }
48
        }
49
    }
50
51
    /**
52
     * @param \DateTime $CalendarDate
53
     * @return \Gueststream\PMS\IQWare\API\UnitAvailabilityCalendar
54
     */
55
    public function setCalendarDate(\DateTime $CalendarDate)
56
    {
57
        $this->CalendarDate = $CalendarDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $CalendarDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $CalendarDate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
58
        return $this;
59
    }
60
61
    /**
62
     * @return boolean
63
     */
64
    public function getAvailableForArrival()
65
    {
66
        return $this->AvailableForArrival;
67
    }
68
69
    /**
70
     * @param boolean $AvailableForArrival
71
     * @return \Gueststream\PMS\IQWare\API\UnitAvailabilityCalendar
72
     */
73
    public function setAvailableForArrival($AvailableForArrival)
74
    {
75
        $this->AvailableForArrival = $AvailableForArrival;
76
        return $this;
77
    }
78
79
    /**
80
     * @return boolean
81
     */
82
    public function getAvailableForDeparture()
83
    {
84
        return $this->AvailableForDeparture;
85
    }
86
87
    /**
88
     * @param boolean $AvailableForDeparture
89
     * @return \Gueststream\PMS\IQWare\API\UnitAvailabilityCalendar
90
     */
91
    public function setAvailableForDeparture($AvailableForDeparture)
92
    {
93
        $this->AvailableForDeparture = $AvailableForDeparture;
94
        return $this;
95
    }
96
}
97