AbstractMedia::setType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace MediaMonks\SonataMediaBundle\Model;
4
5
abstract class AbstractMedia implements MediaInterface
6
{
7
    /**
8
     * @var int
9
     */
10
    protected $id;
11
12
    /**
13
     * @var string
14
     */
15
    protected $title;
16
17
    /**
18
     * @var string
19
     */
20
    protected $description;
21
22
    /**
23
     * @var string
24
     */
25
    protected $provider;
26
27
    /**
28
     * @var string
29
     */
30
    protected $type;
31
32
    /**
33
     * @var string
34
     */
35
    protected $providerReference;
36
37
    /**
38
     * @var array
39
     */
40
    protected $providerMetaData = [];
41
42
    /**
43
     * @var string
44
     */
45
    protected $image;
46
47
    /**
48
     * @var array
49
     */
50
    protected $imageMetaData = [];
51
52
    /**
53
     * @var string
54
     */
55
    protected $focalPoint;
56
57
    /**
58
     * @var string
59
     */
60
    protected $copyright;
61
62
    /**
63
     * @var string
64
     */
65
    protected $authorName;
66
67
    /**
68
     * @var \DateTime
69
     */
70
    protected $createdAt;
71
72
    /**
73
     * @var \DateTime
74
     */
75
    protected $updatedAt;
76
77
    /**
78
     * @var string
79
     */
80
    protected $binaryContent;
81
82
    /**
83
     * @var string
84
     */
85
    protected $imageContent;
86
87 13
    public function __construct()
88
    {
89 13
        $this->createdAt = new \DateTime;
90 13
        $this->updatedAt = new \DateTime;
91 13
    }
92
93
    /**
94
     * @return mixed
95
     */
96 12
    public function getId()
97
    {
98 12
        return $this->id;
99
    }
100
101
    /**
102
     * @param mixed $id
103
     * @return AbstractMedia
104
     */
105 1
    public function setId($id)
106
    {
107 1
        $this->id = $id;
108
109 1
        return $this;
110
    }
111
112
    /**
113
     * @return mixed
114
     */
115 12
    public function getTitle()
116
    {
117 12
        return $this->title;
118
    }
119
120
    /**
121
     * @param mixed $title
122
     * @return AbstractMedia
123
     */
124 8
    public function setTitle($title)
125
    {
126 8
        $this->title = $title;
127
128 8
        return $this;
129
    }
130
131
    /**
132
     * @return mixed
133
     */
134 8
    public function getDescription()
135
    {
136 8
        return $this->description;
137
    }
138
139
    /**
140
     * @param string $description
141
     * @return AbstractMedia
142
     */
143 4
    public function setDescription($description)
144
    {
145 4
        $this->description = $description;
146
147 4
        return $this;
148
    }
149
150
    /**
151
     * @return string
152
     */
153 13
    public function getProvider()
154
    {
155 13
        return $this->provider;
156
    }
157
158
    /**
159
     * @param string $provider
160
     * @return AbstractMedia
161
     */
162 13
    public function setProvider($provider)
163
    {
164 13
        $this->provider = $provider;
165
166 13
        return $this;
167
    }
168
169
    /**
170
     * @return mixed
171
     */
172 12
    public function getType()
173
    {
174 12
        return $this->type;
175
    }
176
177
    /**
178
     * @param mixed $type
179
     * @return MediaInterface
180
     */
181 12
    public function setType($type)
182
    {
183 12
        $this->type = $type;
184
185 12
        return $this;
186
    }
187
188
    /**
189
     * @return mixed
190
     */
191 13
    public function getProviderReference()
192
    {
193 13
        return $this->providerReference;
194
    }
195
196
    /**
197
     * @param mixed $providerReference
198
     */
199 9
    public function setProviderReference($providerReference)
200
    {
201 9
        $this->providerReference = $providerReference;
202 9
    }
203
204
    /**
205
     * @return array
206
     */
207 8
    public function getProviderMetaData()
208
    {
209 8
        return $this->providerMetaData;
210
    }
211
212
    /**
213
     * @param array $providerMetaData
214
     */
215 8
    public function setProviderMetaData(array $providerMetaData)
216
    {
217 8
        $this->providerMetaData = $providerMetaData;
218 8
    }
219
220
    /**
221
     * @return mixed
222
     */
223 8
    public function getImage()
224
    {
225 8
        return $this->image;
226
    }
227
228
    /**
229
     * @param mixed $image
230
     * @return MediaInterface
231
     */
232 8
    public function setImage($image)
233
    {
234 8
        $this->image = $image;
235
236 8
        return $this;
237
    }
238
239
    /**
240
     * @return array
241
     */
242 1
    public function getImageMetaData()
243
    {
244 1
        return $this->imageMetaData;
245
    }
246
247
    /**
248
     * @param array $imageMetaData
249
     * @return MediaInterface
250
     */
251 5
    public function setImageMetaData(array $imageMetaData)
252
    {
253 5
        $this->imageMetaData = $imageMetaData;
254
255 5
        return $this;
256
    }
257
258
    /**
259
     * @return mixed
260
     */
261 8
    public function getFocalPoint()
262
    {
263 8
        if (empty($this->focalPoint)) {
264 8
            return '50-50';
265
        }
266
267 4
        return $this->focalPoint;
268
    }
269
270
    /**
271
     * @param mixed $focalPoint
272
     * @return MediaInterface
273
     */
274 4
    public function setFocalPoint($focalPoint)
275
    {
276 4
        $this->focalPoint = $focalPoint;
277
278 4
        return $this;
279
    }
280
281
    /**
282
     * @return mixed
283
     */
284 8
    public function getCopyright()
285
    {
286 8
        return $this->copyright;
287
    }
288
289
    /**
290
     * @param mixed $copyright
291
     * @return AbstractMedia
292
     */
293 4
    public function setCopyright($copyright)
294
    {
295 4
        $this->copyright = $copyright;
296
297 4
        return $this;
298
    }
299
300
    /**
301
     * @return mixed
302
     */
303 8
    public function getAuthorName()
304
    {
305 8
        return $this->authorName;
306
    }
307
308
    /**
309
     * @param mixed $authorName
310
     * @return MediaInterface
311
     */
312 4
    public function setAuthorName($authorName)
313
    {
314 4
        $this->authorName = $authorName;
315
316 4
        return $this;
317
    }
318
319
    /**
320
     * @return string
321
     */
322 8
    public function getBinaryContent()
323
    {
324 8
        return $this->binaryContent;
325
    }
326
327
    /**
328
     * @param string $binaryContent
329
     * @return MediaInterface
330
     */
331 6
    public function setBinaryContent($binaryContent)
332
    {
333 6
        $this->binaryContent = $binaryContent;
334
335 6
        return $this;
336
    }
337
338
    /**
339
     * @return mixed
340
     */
341 1
    public function getSlug()
342
    {
343 1
        return $this->getId();
344
    }
345
346
    /**
347
     * @return mixed
348
     */
349 1
    public function getCreatedAt()
350
    {
351 1
        return $this->createdAt;
352
    }
353
354
    /**
355
     * @param mixed $createdAt
356
     * @return MediaInterface
357
     */
358 1
    public function setCreatedAt($createdAt)
359
    {
360 1
        $this->createdAt = $createdAt;
361
362 1
        return $this;
363
    }
364
365
    /**
366
     * @return \DateTime
367
     */
368 6
    public function getUpdatedAt()
369
    {
370 6
        return $this->updatedAt;
371
    }
372
373
    /**
374
     * @param \DateTime $updatedAt
375
     * @return MediaInterface
376
     */
377 1
    public function setUpdatedAt($updatedAt)
378
    {
379 1
        $this->updatedAt = $updatedAt;
380
381 1
        return $this;
382
    }
383
384
    /**
385
     * @return string
386
     */
387 7
    public function getImageContent()
388
    {
389 7
        return $this->imageContent;
390
    }
391
392
    /**
393
     * @param string $imageContent
394
     * @return MediaInterface
395
     */
396 2
    public function setImageContent($imageContent)
397
    {
398 2
        $this->imageContent = $imageContent;
399
400 2
        return $this;
401
    }
402
403
    /**
404
     * @return mixed
405
     */
406 12
    public function __toString()
407
    {
408 12
        return sprintf('%s (%s)', $this->getTitle(), $this->getType());
409
    }
410
}
411