UnitDate::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Gueststream\PMS\IQWare\API;
4
5 View Code Duplication
class UnitDate
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 $ADate
10
     */
11
    protected $ADate = null;
12
13
    /**
14
     * @var ArrayOfUnitAvailable $Units
15
     */
16
    protected $Units = null;
17
18
    /**
19
     * @param \DateTime $ADate
20
     */
21
    public function __construct(\DateTime $ADate)
22
    {
23
        $this->ADate = $ADate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $ADate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $ADate.

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...
24
    }
25
26
    /**
27
     * @return \DateTime
28
     */
29
    public function getADate()
30
    {
31
        if ($this->ADate == null) {
32
            return null;
33
        } else {
34
            try {
35
                return new \DateTime($this->ADate);
36
            } catch (\Exception $e) {
37
                return false;
38
            }
39
        }
40
    }
41
42
    /**
43
     * @param \DateTime $ADate
44
     * @return \Gueststream\PMS\IQWare\API\UnitDate
45
     */
46
    public function setADate(\DateTime $ADate)
47
    {
48
        $this->ADate = $ADate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $ADate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $ADate.

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...
49
        return $this;
50
    }
51
52
    /**
53
     * @return ArrayOfUnitAvailable
54
     */
55
    public function getUnits()
56
    {
57
        return $this->Units;
58
    }
59
60
    /**
61
     * @param ArrayOfUnitAvailable $Units
62
     * @return \Gueststream\PMS\IQWare\API\UnitDate
63
     */
64
    public function setUnits($Units)
65
    {
66
        $this->Units = $Units;
67
        return $this;
68
    }
69
}
70