Task   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 156
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 11
lcom 1
cbo 0
dl 0
loc 156
rs 10
c 1
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 4 1
A getName() 0 4 1
A setName() 0 4 1
A getStatus() 0 4 1
A setStatus() 0 4 1
A getCreatedAt() 0 4 1
A setCreatedAt() 0 4 1
A getUpdatedAt() 0 4 1
A setUpdatedAt() 0 4 1
A jsonSerialize() 0 8 1
1
<?php
2
3
namespace Todo\Domain;
4
5
/**
6
 * Class Task
7
 *
8
 * Task object definition
9
 *
10
 * @category None
11
 * @package  Todo\Domain
12
 * @author   Martin Pham <[email protected]>
13
 * @license  None http://
14
 * @link     None
15
 */
16
class Task implements \JsonSerializable
17
{
18
    /**
19
     * Task's statuses
20
     */
21
    const STATUS_REMAINING = 'remaining';
22
    const STATUS_COMPLETED = 'completed';
23
24
    /**
25
     * Id
26
     *
27
     * @var mixed
28
     */
29
    protected $id;
30
31
    /**
32
     * Name
33
     *
34
     * @var string
35
     */
36
    protected $name;
37
38
    /**
39
     * Status
40
     * We want default Task's status is remaining
41
     *
42
     * @var string
43
     */
44
    protected $status = Task::STATUS_REMAINING;
45
46
    /**
47
     * Created time
48
     *
49
     * @var \DateTime
50
     */
51
    protected $createdAt;
52
53
    /**
54
     * Updated time
55
     *
56
     * @var \DateTime
57
     */
58
    protected $updatedAt;
59
60
    /**
61
     * Get Id
62
     *
63
     * @return mixed
64
     */
65
    public function getId()
66
    {
67
        return $this->id;
68
    }
69
70
    /**
71
     * Set Id
72
     *
73
     * @param mixed $id Id
74
     */
75
    public function setId($id)
76
    {
77
        $this->id = $id;
78
    }
79
80
    /**
81
     * Get Name
82
     *
83
     * @return mixed
84
     */
85
    public function getName()
86
    {
87
        return $this->name;
88
    }
89
90
    /**
91
     * Set Name
92
     *
93
     * @param mixed $name Name
94
     */
95
    public function setName($name)
96
    {
97
        $this->name = $name;
98
    }
99
100
    /**
101
     * Get Status
102
     *
103
     * @return mixed
104
     */
105
    public function getStatus()
106
    {
107
        return $this->status;
108
    }
109
110
    /**
111
     * Set Status
112
     *
113
     * @param mixed $status Status
114
     */
115
    public function setStatus($status)
116
    {
117
        $this->status = $status;
118
    }
119
120
    /**
121
     * Get CreatedAt
122
     *
123
     * @return mixed
124
     */
125
    public function getCreatedAt()
126
    {
127
        return $this->createdAt;
128
    }
129
130
    /**
131
     * Set CreatedAt
132
     *
133
     * @param mixed $createdAt CreatedAt
134
     */
135
    public function setCreatedAt($createdAt)
136
    {
137
        $this->createdAt = $createdAt;
138
    }
139
140
    /**
141
     * Get UpdatedAt
142
     *
143
     * @return mixed
144
     */
145
    public function getUpdatedAt()
146
    {
147
        return $this->updatedAt;
148
    }
149
150
    /**
151
     * Set UpdatedAt
152
     *
153
     * @param mixed $updatedAt UpdatedAt
154
     */
155
    public function setUpdatedAt($updatedAt)
156
    {
157
        $this->updatedAt = $updatedAt;
158
    }
159
160
    /**
161
     * @inheritDoc
162
     */
163
    public function jsonSerialize()
164
    {
165
        return [
166
            'id' => $this->getId(),
167
            'name' => $this->getName(),
168
            'status' => $this->getStatus()
169
        ];
170
    }
171
}
172