WebRes_GetOwnerRoomAvailability   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 150
Duplicated Lines 100 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 15
lcom 2
cbo 0
dl 150
loc 150
ccs 0
cts 69
cp 0
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 8 8 1
A getGuid() 4 4 1
A setGuid() 5 5 1
A getRoomID() 4 4 1
A setRoomID() 5 5 1
A getStartDate() 12 12 3
A setStartDate() 5 5 1
A getEndDate() 12 12 3
A setEndDate() 5 5 1
A getIsSuite() 4 4 1
A setIsSuite() 5 5 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Gueststream\PMS\IQWare\API;
4
5 View Code Duplication
class WebRes_GetOwnerRoomAvailability
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 $guid
10
     */
11
    protected $guid = null;
12
13
    /**
14
     * @var int $roomID
15
     */
16
    protected $roomID = null;
17
18
    /**
19
     * @var \DateTime $startDate
20
     */
21
    protected $startDate = null;
22
23
    /**
24
     * @var \DateTime $endDate
25
     */
26
    protected $endDate = null;
27
28
    /**
29
     * @var boolean $isSuite
30
     */
31
    protected $isSuite = null;
32
33
    /**
34
     * @param int $guid
35
     * @param int $roomID
36
     * @param \DateTime $startDate
37
     * @param \DateTime $endDate
38
     * @param boolean $isSuite
39
     */
40
    public function __construct($guid, $roomID, \DateTime $startDate, \DateTime $endDate, $isSuite)
41
    {
42
        $this->guid = $guid;
43
        $this->roomID = $roomID;
44
        $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...
45
        $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...
46
        $this->isSuite = $isSuite;
47
    }
48
49
    /**
50
     * @return int
51
     */
52
    public function getGuid()
53
    {
54
        return $this->guid;
55
    }
56
57
    /**
58
     * @param int $guid
59
     * @return \Gueststream\PMS\IQWare\API\WebRes_GetOwnerRoomAvailability
60
     */
61
    public function setGuid($guid)
62
    {
63
        $this->guid = $guid;
64
        return $this;
65
    }
66
67
    /**
68
     * @return int
69
     */
70
    public function getRoomID()
71
    {
72
        return $this->roomID;
73
    }
74
75
    /**
76
     * @param int $roomID
77
     * @return \Gueststream\PMS\IQWare\API\WebRes_GetOwnerRoomAvailability
78
     */
79
    public function setRoomID($roomID)
80
    {
81
        $this->roomID = $roomID;
82
        return $this;
83
    }
84
85
    /**
86
     * @return \DateTime
87
     */
88
    public function getStartDate()
89
    {
90
        if ($this->startDate == null) {
91
            return null;
92
        } else {
93
            try {
94
                return new \DateTime($this->startDate);
95
            } catch (\Exception $e) {
96
                return false;
97
            }
98
        }
99
    }
100
101
    /**
102
     * @param \DateTime $startDate
103
     * @return \Gueststream\PMS\IQWare\API\WebRes_GetOwnerRoomAvailability
104
     */
105
    public function setStartDate(\DateTime $startDate)
106
    {
107
        $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...
108
        return $this;
109
    }
110
111
    /**
112
     * @return \DateTime
113
     */
114
    public function getEndDate()
115
    {
116
        if ($this->endDate == null) {
117
            return null;
118
        } else {
119
            try {
120
                return new \DateTime($this->endDate);
121
            } catch (\Exception $e) {
122
                return false;
123
            }
124
        }
125
    }
126
127
    /**
128
     * @param \DateTime $endDate
129
     * @return \Gueststream\PMS\IQWare\API\WebRes_GetOwnerRoomAvailability
130
     */
131
    public function setEndDate(\DateTime $endDate)
132
    {
133
        $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...
134
        return $this;
135
    }
136
137
    /**
138
     * @return boolean
139
     */
140
    public function getIsSuite()
141
    {
142
        return $this->isSuite;
143
    }
144
145
    /**
146
     * @param boolean $isSuite
147
     * @return \Gueststream\PMS\IQWare\API\WebRes_GetOwnerRoomAvailability
148
     */
149
    public function setIsSuite($isSuite)
150
    {
151
        $this->isSuite = $isSuite;
152
        return $this;
153
    }
154
}
155