DailyManualRates::setManualRateType()   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 DailyManualRates
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 $Date
10
     */
11
    protected $Date = null;
12
13
    /**
14
     * @var float $ManualRate
15
     */
16
    protected $ManualRate = null;
17
18
    /**
19
     * @var int $ID_RateReason
20
     */
21
    protected $ID_RateReason = null;
22
23
    /**
24
     * @var int $ManualRateType
25
     */
26
    protected $ManualRateType = null;
27
28
    /**
29
     * @param \DateTime $Date
30
     * @param float $ManualRate
31
     * @param int $ID_RateReason
32
     * @param int $ManualRateType
33
     */
34
    public function __construct(\DateTime $Date, $ManualRate, $ID_RateReason, $ManualRateType)
35
    {
36
        $this->Date = $Date->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $Date->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $Date.

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...
37
        $this->ManualRate = $ManualRate;
38
        $this->ID_RateReason = $ID_RateReason;
39
        $this->ManualRateType = $ManualRateType;
40
    }
41
42
    /**
43
     * @return \DateTime
44
     */
45
    public function getDate()
46
    {
47
        if ($this->Date == null) {
48
            return null;
49
        } else {
50
            try {
51
                return new \DateTime($this->Date);
52
            } catch (\Exception $e) {
53
                return false;
54
            }
55
        }
56
    }
57
58
    /**
59
     * @param \DateTime $Date
60
     * @return \Gueststream\PMS\IQWare\API\DailyManualRates
61
     */
62
    public function setDate(\DateTime $Date)
63
    {
64
        $this->Date = $Date->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $Date->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $Date.

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...
65
        return $this;
66
    }
67
68
    /**
69
     * @return float
70
     */
71
    public function getManualRate()
72
    {
73
        return $this->ManualRate;
74
    }
75
76
    /**
77
     * @param float $ManualRate
78
     * @return \Gueststream\PMS\IQWare\API\DailyManualRates
79
     */
80
    public function setManualRate($ManualRate)
81
    {
82
        $this->ManualRate = $ManualRate;
83
        return $this;
84
    }
85
86
    /**
87
     * @return int
88
     */
89
    public function getID_RateReason()
90
    {
91
        return $this->ID_RateReason;
92
    }
93
94
    /**
95
     * @param int $ID_RateReason
96
     * @return \Gueststream\PMS\IQWare\API\DailyManualRates
97
     */
98
    public function setID_RateReason($ID_RateReason)
99
    {
100
        $this->ID_RateReason = $ID_RateReason;
101
        return $this;
102
    }
103
104
    /**
105
     * @return int
106
     */
107
    public function getManualRateType()
108
    {
109
        return $this->ManualRateType;
110
    }
111
112
    /**
113
     * @param int $ManualRateType
114
     * @return \Gueststream\PMS\IQWare\API\DailyManualRates
115
     */
116
    public function setManualRateType($ManualRateType)
117
    {
118
        $this->ManualRateType = $ManualRateType;
119
        return $this;
120
    }
121
}
122