Item::setItemId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
namespace Wonnova\SDK\Model;
3
4
use JMS\Serializer\Annotation as JMS;
5
use Wonnova\SDK\Common\WonnovaDateTimeParserTrait;
6
7
/**
8
 * Class Item
9
 * @author Wonnova
10
 * @link http://www.wonnova.com
11
 */
12
class Item extends AbstractModel
13
{
14
    use WonnovaDateTimeParserTrait;
15
16
    /**
17
     * Used to map virtual to real fields
18
     *
19
     * @var array
20
     * @JMS\Exclude()
21
     */
22
    protected $fieldMapping = [
23
        'id' => 'itemId'
24
    ];
25
26
    /**
27
     * @var string
28
     * @JMS\Type("string")
29
     * @JMS\SerializedName("id")
30
     */
31
    private $itemId;
32
    /**
33
     * @var string
34
     * @JMS\Type("string")
35
     */
36
    private $title;
37
    /**
38
     * @var string
39
     * @JMS\Type("string")
40
     */
41
    private $description;
42
    /**
43
     * @var string
44
     * @JMS\Type("string")
45
     */
46
    private $author;
47
    /**
48
     * @var integer
49
     * @JMS\Type("integer")
50
     */
51
    private $score;
52
    /**
53
     * @var \DateTime
54
     * @JMS\Type("WonnovaDateTime")
55
     */
56
    private $dateCreated;
57
58
    /**
59
     * @return mixed
60
     */
61 4
    public function getItemId()
62
    {
63 4
        return $this->itemId;
64
    }
65
66
    /**
67
     * @param mixed $itemId
68
     * @return $this
69
     */
70 9
    public function setItemId($itemId)
71
    {
72 9
        $this->itemId = $itemId;
73 9
        return $this;
74
    }
75
76
    /**
77
     * @return mixed
78
     */
79 4
    public function getTitle()
80
    {
81 4
        return $this->title;
82
    }
83
84
    /**
85
     * @param mixed $title
86
     * @return $this
87
     */
88 5
    public function setTitle($title)
89
    {
90 5
        $this->title = $title;
91 5
        return $this;
92
    }
93
94
    /**
95
     * @return string
96
     */
97 4
    public function getDescription()
98
    {
99 4
        return $this->description;
100
    }
101
102
    /**
103
     * @param string $description
104
     * @return $this
105
     */
106 4
    public function setDescription($description)
107
    {
108 4
        $this->description = $description;
109 4
        return $this;
110
    }
111
112
    /**
113
     * @return string
114
     */
115 4
    public function getAuthor()
116
    {
117 4
        return $this->author;
118
    }
119
120
    /**
121
     * @param string $author
122
     * @return $this
123
     */
124 7
    public function setAuthor($author)
125
    {
126 7
        $this->author = $author;
127 7
        return $this;
128
    }
129
130
    /**
131
     * @return int
132
     */
133 3
    public function getScore()
134
    {
135 3
        return $this->score;
136
    }
137
138
    /**
139
     * @param int $score
140
     * @return $this
141
     */
142 2
    public function setScore($score)
143
    {
144 2
        $this->score = $score;
145 2
        return $this;
146
    }
147
148
    /**
149
     * @return \DateTime
150
     */
151 4
    public function getDateCreated()
152
    {
153 4
        return $this->dateCreated;
154
    }
155
156
    /**
157
     * @param \DateTime|string $dateCreated
158
     * @return $this
159
     */
160 3
    public function setDateCreated($dateCreated)
161
    {
162 3
        $this->dateCreated = $this->parseWonnovaDateTime($dateCreated);
163 3
        return $this;
164
    }
165
166 7
    public function toArray()
167
    {
168
        return [
169 7
            'id' => $this->itemId,
170 7
            'title' => $this->title,
171 7
            'description' => $this->description,
172 7
            'author' => $this->author
173 7
        ];
174
    }
175
}
176