getDeleted   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 95
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 26
c 1
b 0
f 0
dl 0
loc 95
rs 10
wmc 13

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setSObjectType() 0 4 1
A setEndDate() 0 4 1
A getEndDate() 0 9 3
A getSObjectType() 0 3 1
A getStartDate() 0 9 3
A __construct() 0 5 3
A setStartDate() 0 4 1
1
<?php
2
3
namespace SForce\Wsdl;
4
5
class getDeleted
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $sObjectType = null;
11
12
    /**
13
     * @var \DateTime
14
     */
15
    protected $startDate = null;
16
17
    /**
18
     * @var \DateTime
19
     */
20
    protected $endDate = null;
21
22
    /**
23
     * @param string $sObjectType
24
     * @param \DateTime $startDate
25
     * @param \DateTime $endDate
26
     */
27
    public function __construct($sObjectType = null, \DateTime $startDate = null, \DateTime $endDate = null)
28
    {
29
        $this->sObjectType = $sObjectType;
30
        $this->startDate = $startDate ? $startDate->format(\DateTime::ATOM) : null;
31
        $this->endDate = $endDate ? $endDate->format(\DateTime::ATOM) : null;
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getSObjectType()
38
    {
39
        return $this->sObjectType;
40
    }
41
42
    /**
43
     * @param string $sObjectType
44
     * @return \SForce\Wsdl\getDeleted
45
     */
46
    public function setSObjectType($sObjectType)
47
    {
48
        $this->sObjectType = $sObjectType;
49
        return $this;
50
    }
51
52
    /**
53
     * @return \DateTime
54
     */
55
    public function getStartDate()
56
    {
57
        if ($this->startDate === null) {
58
            return null;
59
        }
60
        try {
61
            return new \DateTime($this->startDate);
62
        } catch (\Exception $e) {
63
            return false;
64
        }
65
    }
66
67
    /**
68
     * @param \DateTime $startDate
69
     * @return \SForce\Wsdl\getDeleted
70
     */
71
    public function setStartDate(\DateTime $startDate)
72
    {
73
        $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 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...
74
        return $this;
75
    }
76
77
    /**
78
     * @return \DateTime
79
     */
80
    public function getEndDate()
81
    {
82
        if ($this->endDate === null) {
83
            return null;
84
        }
85
        try {
86
            return new \DateTime($this->endDate);
0 ignored issues
show
Bug introduced by
$this->endDate of type DateTime is incompatible with the type string expected by parameter $time of DateTime::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

86
            return new \DateTime(/** @scrutinizer ignore-type */ $this->endDate);
Loading history...
87
        } catch (\Exception $e) {
88
            return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the documented return type DateTime.
Loading history...
89
        }
90
    }
91
92
    /**
93
     * @param \DateTime $endDate
94
     * @return \SForce\Wsdl\getDeleted
95
     */
96
    public function setEndDate(\DateTime $endDate)
97
    {
98
        $this->endDate = $endDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $endDate->format(DateTime::ATOM) of type string is incompatible with the declared type DateTime of property $endDate.

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...
99
        return $this;
100
    }
101
}
102