Completed
Push — master ( c49bae...43ad9f )
by
unknown
09:25
created

AbstractMedia   B

Complexity

Total Complexity 36

Size/Duplication

Total Lines 394
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 78.89%

Importance

Changes 0
Metric Value
wmc 36
lcom 2
cbo 0
dl 0
loc 394
ccs 71
cts 90
cp 0.7889
rs 8.8
c 0
b 0
f 0

35 Methods

Rating   Name   Duplication   Size   Complexity  
A setId() 0 4 1
A getImageMetaData() 0 4 1
A setFocalPoint() 0 6 1
A getSlug() 0 4 1
A getCreatedAt() 0 4 1
A setCreatedAt() 0 6 1
A setUpdatedAt() 0 6 1
A __construct() 0 5 1
A getId() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 4 1
A getDescription() 0 4 1
A getProvider() 0 4 1
A setProvider() 0 6 1
A getType() 0 4 1
A setType() 0 6 1
A getProviderReference() 0 4 1
A setProviderReference() 0 4 1
A setProviderMetaData() 0 4 1
A getImage() 0 4 1
A setImage() 0 6 1
A getFocalPoint() 0 8 2
A getCopyright() 0 4 1
A getAuthorName() 0 4 1
A setAuthorName() 0 6 1
A getUpdatedAt() 0 4 1
A getImageContent() 0 4 1
A __toString() 0 4 1
A setDescription() 0 4 1
A getProviderMetaData() 0 4 1
A setCopyright() 0 4 1
A setImageMetaData() 0 6 1
A getBinaryContent() 0 4 1
A setBinaryContent() 0 6 1
A setImageContent() 0 6 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 5
    public function __construct()
88
    {
89 5
        $this->createdAt = new \DateTime;
90 5
        $this->updatedAt = new \DateTime;
91 5
    }
92
93
    /**
94
     * @return mixed
95
     */
96 5
    public function getId()
97
    {
98 5
        return $this->id;
99
    }
100
101
    /**
102
     * @param mixed $id
103
     */
104
    public function setId($id)
105
    {
106
        $this->id = $id;
107
    }
108
109
    /**
110
     * @return mixed
111
     */
112 5
    public function getTitle()
113
    {
114 5
        return $this->title;
115
    }
116
117
    /**
118
     * @param mixed $title
119
     */
120 5
    public function setTitle($title)
121
    {
122 5
        $this->title = $title;
123 5
    }
124
125
    /**
126
     * @return mixed
127
     */
128 5
    public function getDescription()
129
    {
130 5
        return $this->description;
131
    }
132
133
    /**
134
     * @param mixed $description
135
     */
136 3
    public function setDescription($description)
137
    {
138 3
        $this->description = $description;
139 3
    }
140
141
    /**
142
     * @return mixed
143
     */
144 5
    public function getProvider()
145
    {
146 5
        return $this->provider;
147
    }
148
149
    /**
150
     * @param mixed $provider
151
     * @return Media
152
     */
153 5
    public function setProvider($provider)
154
    {
155 5
        $this->provider = $provider;
156
157 5
        return $this;
158
    }
159
160
    /**
161
     * @return mixed
162
     */
163 5
    public function getType()
164
    {
165 5
        return $this->type;
166
    }
167
168
    /**
169
     * @param mixed $type
170
     * @return MediaInterface
171
     */
172 5
    public function setType($type)
173
    {
174 5
        $this->type = $type;
175
176 5
        return $this;
177
    }
178
179
    /**
180
     * @return mixed
181
     */
182 5
    public function getProviderReference()
183
    {
184 5
        return $this->providerReference;
185
    }
186
187
    /**
188
     * @param mixed $providerReference
189
     */
190 5
    public function setProviderReference($providerReference)
191
    {
192 5
        $this->providerReference = $providerReference;
193 5
    }
194
195
    /**
196
     * @return array
197
     */
198 3
    public function getProviderMetaData()
199
    {
200 3
        return $this->providerMetaData;
201
    }
202
203
    /**
204
     * @param array $providerMetaData
205
     */
206 5
    public function setProviderMetaData(array $providerMetaData)
207
    {
208 5
        $this->providerMetaData = $providerMetaData;
209 5
    }
210
211
    /**
212
     * @return mixed
213
     */
214 5
    public function getImage()
215
    {
216 5
        return $this->image;
217
    }
218
219
    /**
220
     * @param mixed $image
221
     * @return MediaInterface
222
     */
223 5
    public function setImage($image)
224
    {
225 5
        $this->image = $image;
226
227 5
        return $this;
228
    }
229
230
    /**
231
     * @return array
232
     */
233
    public function getImageMetaData()
234
    {
235
        return $this->imageMetaData;
236
    }
237
238
    /**
239
     * @param array $imageMetaData
240
     * @return MediaInterface
241
     */
242 2
    public function setImageMetaData(array $imageMetaData)
243
    {
244 2
        $this->imageMetaData = $imageMetaData;
245
246 2
        return $this;
247
    }
248
249
    /**
250
     * @return mixed
251
     */
252 5
    public function getFocalPoint()
253
    {
254 5
        if (empty($this->focalPoint)) {
255 5
            return '50-50';
256
        }
257
258
        return $this->focalPoint;
259
    }
260
261
    /**
262
     * @param mixed $focalPoint
263
     * @return MediaInterface
264
     */
265
    public function setFocalPoint($focalPoint)
266
    {
267
        $this->focalPoint = $focalPoint;
268
269
        return $this;
270
    }
271
272
    /**
273
     * @return mixed
274
     */
275 5
    public function getCopyright()
276
    {
277 5
        return $this->copyright;
278
    }
279
280
    /**
281
     * @param mixed $copyright
282
     */
283 3
    public function setCopyright($copyright)
284
    {
285 3
        $this->copyright = $copyright;
286 3
    }
287
288
    /**
289
     * @return mixed
290
     */
291 5
    public function getAuthorName()
292
    {
293 5
        return $this->authorName;
294
    }
295
296
    /**
297
     * @param mixed $authorName
298
     * @return MediaInterface
299
     */
300 3
    public function setAuthorName($authorName)
301
    {
302 3
        $this->authorName = $authorName;
303
304 3
        return $this;
305
    }
306
307
    /**
308
     * @return string
309
     */
310 2
    public function getBinaryContent()
311
    {
312 2
        return $this->binaryContent;
313
    }
314
315
    /**
316
     * @param string $binaryContent
317
     * @return MediaInterface
318
     */
319 2
    public function setBinaryContent($binaryContent)
320
    {
321 2
        $this->binaryContent = $binaryContent;
322
323 2
        return $this;
324
    }
325
326
    /**
327
     * @return mixed
328
     */
329
    public function getSlug()
330
    {
331
        return $this->getId();
332
    }
333
334
    /**
335
     * @return mixed
336
     */
337
    public function getCreatedAt()
338
    {
339
        return $this->createdAt;
340
    }
341
342
    /**
343
     * @param mixed $createdAt
344
     * @return MediaInterface
345
     */
346
    public function setCreatedAt($createdAt)
347
    {
348
        $this->createdAt = $createdAt;
349
350
        return $this;
351
    }
352
353
    /**
354
     * @return \DateTime
355
     */
356 5
    public function getUpdatedAt()
357
    {
358 5
        return $this->updatedAt;
359
    }
360
361
    /**
362
     * @param \DateTime $updatedAt
363
     * @return MediaInterface
364
     */
365
    public function setUpdatedAt($updatedAt)
366
    {
367
        $this->updatedAt = $updatedAt;
368
369
        return $this;
370
    }
371
372
    /**
373
     * @return string
374
     */
375 5
    public function getImageContent()
376
    {
377 5
        return $this->imageContent;
378
    }
379
380
    /**
381
     * @param string $imageContent
382
     * @return MediaInterface
383
     */
384 1
    public function setImageContent($imageContent)
385
    {
386 1
        $this->imageContent = $imageContent;
387
388 1
        return $this;
389
    }
390
391
    /**
392
     * @return mixed
393
     */
394 5
    public function __toString()
395
    {
396 5
        return sprintf('%s (%s)', $this->getTitle(), $this->getType());
397
    }
398
}
399