Completed
Branch master (841483)
by methylbro
02:19
created

ListInfo::getModifiedDate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of the Mediapart Selligent Client API
5
 *
6
 * CC BY-NC-SA <https://github.com/mediapart/selligent>
7
 *
8
 * For the full license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Mediapart\Selligent;
13
14
/**
15
 * List datastructure
16
 */
17
class ListInfo
18
{
19
    /**
20
     *
21
     */
22
    public static $datetime_format = 'Y-m-d\TH:i:s.u';
23
24
    /**
25
     * @var integer
26
     */
27
    protected $ID;
28
29
    /**
30
     * @var string
31
     */
32
    protected $Name;
33
34
    /**
35
     * @var string
36
     */
37
    protected $Description;
38
39
    /**
40
     * @var string
41
     */
42
    protected $CreatedDate;
43
44
    /**
45
     * @var string
46
     */
47
    protected $ModifiedDate;
48
49
    /**
50
     * @var string
51
     */
52
    protected $Type;
53
54
    /**
55
     * @var string
56
     */
57
    protected $Tag;
58
59
    /**
60
     * @param integer $id
61
     * @param string $name
62
     * @param string $description 
63
     * @param string $type 
64
     * @param string $tag
65
     */
66 2
    public function __construct($id, $name = null, $description = null, $type = null, $tag = null)
67
    {
68 2
        $now = new \DateTime();
69 2
        $this->ID = $id;
70 2
        $this->Name = $name;
71 2
        $this->Description = $description;
72 2
        $this->CreatedDate = $now->format(self::$datetime_format);
73 2
        $this->ModifiedDate = null;
74 2
        $this->Type = $type;
75 2
        $this->Tag = $tag;
76 2
    }
77
78
    /**
79
     * @return integer
80
     */
81 1
    public function getId()
82
    {
83 1
        return $this->ID;
84
    }
85
86
    /**
87
     * @return string|null
88
     */
89 1
    public function getName()
90
    {
91 1
        return $this->Name;
92
    }
93
94
    /**
95
     * @return string|null
96
     */
97 1
    public function getDescription()
98
    {
99 1
        return $this->Description;
100
    }
101
102
    /**
103
     * @return \DateTimeInterface
104
     */
105 1
    public function getCreatedDate()
106
    {
107 1
        return new \DateTime($this->CreatedDate);
108
    }
109
110
    /**
111
     * @return \DateTimeInterface
112
     */
113 2
    public function getModifiedDate()
114
    {
115 2
        if (!is_null($this->ModifiedDate)) {
116 1
            return new \DateTime($this->ModifiedDate);
117
        } else {
118 1
            return null;
119
        }
120
    }
121
122
    /**
123
     * @return string|null
124
     */
125 1
    public function getType()
126
    {
127 1
        return $this->Type;
128
    }
129
130
    /**
131
     * @return string|null
132
     */
133 1
    public function getTag()
134
    {
135 1
        return $this->Tag;
136
    }
137
}
138