WSCRS_GetAvailability   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 42
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getStartDate() 0 12 3
A setStartDate() 0 5 1
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