SpecialOfferByDay   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 92
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 0
dl 92
loc 92
ccs 0
cts 41
cp 0
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getTheDate() 12 12 3
A setTheDate() 5 5 1
A getID_Code() 4 4 1
A setID_Code() 5 5 1
A getAmount() 4 4 1
A setAmount() 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 SpecialOfferByDay
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 $TheDate
10
     */
11
    protected $TheDate = null;
12
13
    /**
14
     * @var int $ID_Code
15
     */
16
    protected $ID_Code = null;
17
18
    /**
19
     * @var float $Amount
20
     */
21
    protected $Amount = null;
22
23
    /**
24
     * @param \DateTime $TheDate
25
     * @param int $ID_Code
26
     * @param float $Amount
27
     */
28
    public function __construct(\DateTime $TheDate, $ID_Code, $Amount)
29
    {
30
        $this->TheDate = $TheDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $TheDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $TheDate.

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

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 int
63
     */
64
    public function getID_Code()
65
    {
66
        return $this->ID_Code;
67
    }
68
69
    /**
70
     * @param int $ID_Code
71
     * @return \Gueststream\PMS\IQWare\API\SpecialOfferByDay
72
     */
73
    public function setID_Code($ID_Code)
74
    {
75
        $this->ID_Code = $ID_Code;
76
        return $this;
77
    }
78
79
    /**
80
     * @return float
81
     */
82
    public function getAmount()
83
    {
84
        return $this->Amount;
85
    }
86
87
    /**
88
     * @param float $Amount
89
     * @return \Gueststream\PMS\IQWare\API\SpecialOfferByDay
90
     */
91
    public function setAmount($Amount)
92
    {
93
        $this->Amount = $Amount;
94
        return $this;
95
    }
96
}
97