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