WSCRS_GetAvailability::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
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
class WSCRS_GetAvailability
6
{
7
8
    /**
9
     * @var \DateTime $StartDate
10
     */
11
    protected $StartDate = null;
12
13
    /**
14
     * @param \DateTime $StartDate
15
     */
16
    public function __construct(\DateTime $StartDate)
17
    {
18
        $this->StartDate = $StartDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $StartDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $StartDate.

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

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...
44
        return $this;
45
    }
46
}
47