GetRoomsAndSuitesAvailability::getStartdate()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 8

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 12
loc 12
ccs 0
cts 12
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 8
nc 3
nop 0
crap 12
1
<?php
2
3
namespace Gueststream\PMS\IQWare\API;
4
5 View Code Duplication
class GetRoomsAndSuitesAvailability
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 int $intGuid
10
     */
11
    protected $intGuid = null;
12
13
    /**
14
     * @var \DateTime $startdate
15
     */
16
    protected $startdate = null;
17
18
    /**
19
     * @var \DateTime $enddate
20
     */
21
    protected $enddate = null;
22
23
    /**
24
     * @var int $roomTypeID
25
     */
26
    protected $roomTypeID = null;
27
28
    /**
29
     * @param int $intGuid
30
     * @param \DateTime $startdate
31
     * @param \DateTime $enddate
32
     * @param int $roomTypeID
33
     */
34
    public function __construct($intGuid, \DateTime $startdate, \DateTime $enddate, $roomTypeID)
35
    {
36
        $this->intGuid = $intGuid;
37
        $this->startdate = $startdate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $startdate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $startdate.

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...
38
        $this->enddate = $enddate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $enddate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $enddate.

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...
39
        $this->roomTypeID = $roomTypeID;
40
    }
41
42
    /**
43
     * @return int
44
     */
45
    public function getIntGuid()
46
    {
47
        return $this->intGuid;
48
    }
49
50
    /**
51
     * @param int $intGuid
52
     * @return \Gueststream\PMS\IQWare\API\GetRoomsAndSuitesAvailability
53
     */
54
    public function setIntGuid($intGuid)
55
    {
56
        $this->intGuid = $intGuid;
57
        return $this;
58
    }
59
60
    /**
61
     * @return \DateTime
62
     */
63
    public function getStartdate()
64
    {
65
        if ($this->startdate == null) {
66
            return null;
67
        } else {
68
            try {
69
                return new \DateTime($this->startdate);
70
            } catch (\Exception $e) {
71
                return false;
72
            }
73
        }
74
    }
75
76
    /**
77
     * @param \DateTime $startdate
78
     * @return \Gueststream\PMS\IQWare\API\GetRoomsAndSuitesAvailability
79
     */
80
    public function setStartdate(\DateTime $startdate)
81
    {
82
        $this->startdate = $startdate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $startdate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $startdate.

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...
83
        return $this;
84
    }
85
86
    /**
87
     * @return \DateTime
88
     */
89
    public function getEnddate()
90
    {
91
        if ($this->enddate == null) {
92
            return null;
93
        } else {
94
            try {
95
                return new \DateTime($this->enddate);
96
            } catch (\Exception $e) {
97
                return false;
98
            }
99
        }
100
    }
101
102
    /**
103
     * @param \DateTime $enddate
104
     * @return \Gueststream\PMS\IQWare\API\GetRoomsAndSuitesAvailability
105
     */
106
    public function setEnddate(\DateTime $enddate)
107
    {
108
        $this->enddate = $enddate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $enddate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $enddate.

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...
109
        return $this;
110
    }
111
112
    /**
113
     * @return int
114
     */
115
    public function getRoomTypeID()
116
    {
117
        return $this->roomTypeID;
118
    }
119
120
    /**
121
     * @param int $roomTypeID
122
     * @return \Gueststream\PMS\IQWare\API\GetRoomsAndSuitesAvailability
123
     */
124
    public function setRoomTypeID($roomTypeID)
125
    {
126
        $this->roomTypeID = $roomTypeID;
127
        return $this;
128
    }
129
}
130