Completed
Push — master ( 8b5863...9f73c5 )
by
unknown
06:52
created

AbstractMedia::getImageMetaData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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