Detail   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 getDate() 12 12 3
A setDate() 5 5 1
A getAmount() 4 4 1
A setAmount() 5 5 1
A getIsPecent() 4 4 1
A setIsPecent() 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 Detail
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 $Amount
15
     */
16
    protected $Amount = null;
17
18
    /**
19
     * @var boolean $IsPecent
20
     */
21
    protected $IsPecent = null;
22
23
    /**
24
     * @param \DateTime $Date
25
     * @param float $Amount
26
     * @param boolean $IsPecent
27
     */
28
    public function __construct(\DateTime $Date, $Amount, $IsPecent)
29
    {
30
        $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...
31
        $this->Amount = $Amount;
32
        $this->IsPecent = $IsPecent;
33
    }
34
35
    /**
36
     * @return \DateTime
37
     */
38
    public function getDate()
39
    {
40
        if ($this->Date == null) {
41
            return null;
42
        } else {
43
            try {
44
                return new \DateTime($this->Date);
45
            } catch (\Exception $e) {
46
                return false;
47
            }
48
        }
49
    }
50
51
    /**
52
     * @param \DateTime $Date
53
     * @return \Gueststream\PMS\IQWare\API\Detail
54
     */
55
    public function setDate(\DateTime $Date)
56
    {
57
        $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...
58
        return $this;
59
    }
60
61
    /**
62
     * @return float
63
     */
64
    public function getAmount()
65
    {
66
        return $this->Amount;
67
    }
68
69
    /**
70
     * @param float $Amount
71
     * @return \Gueststream\PMS\IQWare\API\Detail
72
     */
73
    public function setAmount($Amount)
74
    {
75
        $this->Amount = $Amount;
76
        return $this;
77
    }
78
79
    /**
80
     * @return boolean
81
     */
82
    public function getIsPecent()
83
    {
84
        return $this->IsPecent;
85
    }
86
87
    /**
88
     * @param boolean $IsPecent
89
     * @return \Gueststream\PMS\IQWare\API\Detail
90
     */
91
    public function setIsPecent($IsPecent)
92
    {
93
        $this->IsPecent = $IsPecent;
94
        return $this;
95
    }
96
}
97