getUnitAvailabilityCalendar   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 125
Duplicated Lines 100 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 13
lcom 2
cbo 0
dl 125
loc 125
ccs 0
cts 59
cp 0
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 7 1
A getGuid() 4 4 1
A setGuid() 5 5 1
A getID_Room() 4 4 1
A setID_Room() 5 5 1
A getArrivalDate() 12 12 3
A setArrivalDate() 5 5 1
A getDepartureDate() 12 12 3
A setDepartureDate() 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 getUnitAvailabilityCalendar
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 $ID_Room
15
     */
16
    protected $ID_Room = null;
17
18
    /**
19
     * @var \DateTime $ArrivalDate
20
     */
21
    protected $ArrivalDate = null;
22
23
    /**
24
     * @var \DateTime $DepartureDate
25
     */
26
    protected $DepartureDate = null;
27
28
    /**
29
     * @param int $guid
30
     * @param int $ID_Room
31
     * @param \DateTime $ArrivalDate
32
     * @param \DateTime $DepartureDate
33
     */
34
    public function __construct($guid, $ID_Room, \DateTime $ArrivalDate, \DateTime $DepartureDate)
35
    {
36
        $this->guid = $guid;
37
        $this->ID_Room = $ID_Room;
38
        $this->ArrivalDate = $ArrivalDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $ArrivalDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $ArrivalDate.

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

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...
40
    }
41
42
    /**
43
     * @return int
44
     */
45
    public function getGuid()
46
    {
47
        return $this->guid;
48
    }
49
50
    /**
51
     * @param int $guid
52
     * @return \Gueststream\PMS\IQWare\API\getUnitAvailabilityCalendar
53
     */
54
    public function setGuid($guid)
55
    {
56
        $this->guid = $guid;
57
        return $this;
58
    }
59
60
    /**
61
     * @return int
62
     */
63
    public function getID_Room()
64
    {
65
        return $this->ID_Room;
66
    }
67
68
    /**
69
     * @param int $ID_Room
70
     * @return \Gueststream\PMS\IQWare\API\getUnitAvailabilityCalendar
71
     */
72
    public function setID_Room($ID_Room)
73
    {
74
        $this->ID_Room = $ID_Room;
75
        return $this;
76
    }
77
78
    /**
79
     * @return \DateTime
80
     */
81
    public function getArrivalDate()
82
    {
83
        if ($this->ArrivalDate == null) {
84
            return null;
85
        } else {
86
            try {
87
                return new \DateTime($this->ArrivalDate);
88
            } catch (\Exception $e) {
89
                return false;
90
            }
91
        }
92
    }
93
94
    /**
95
     * @param \DateTime $ArrivalDate
96
     * @return \Gueststream\PMS\IQWare\API\getUnitAvailabilityCalendar
97
     */
98
    public function setArrivalDate(\DateTime $ArrivalDate)
99
    {
100
        $this->ArrivalDate = $ArrivalDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $ArrivalDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $ArrivalDate.

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...
101
        return $this;
102
    }
103
104
    /**
105
     * @return \DateTime
106
     */
107
    public function getDepartureDate()
108
    {
109
        if ($this->DepartureDate == null) {
110
            return null;
111
        } else {
112
            try {
113
                return new \DateTime($this->DepartureDate);
114
            } catch (\Exception $e) {
115
                return false;
116
            }
117
        }
118
    }
119
120
    /**
121
     * @param \DateTime $DepartureDate
122
     * @return \Gueststream\PMS\IQWare\API\getUnitAvailabilityCalendar
123
     */
124
    public function setDepartureDate(\DateTime $DepartureDate)
125
    {
126
        $this->DepartureDate = $DepartureDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $DepartureDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $DepartureDate.

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...
127
        return $this;
128
    }
129
}
130