Completed
Push — master ( 586166...fecb59 )
by Paweł
47:58
created

ArticleMedia::getArticle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of the Superdesk Web Publisher Content Bundle.
5
 *
6
 * Copyright 2016 Sourcefabric z.ú. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2016 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Bundle\ContentBundle\Model;
16
17
use SWP\Component\Bridge\Model\ItemInterface;
18
19
/**
20
 * ArticleMedia represents media which belongs to Article.
21
 */
22
class ArticleMedia implements ArticleMediaInterface
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $id;
28
29
    /**
30
     * @var FileInterface
31
     */
32
    protected $file;
33
34
    /**
35
     * @var ImageInterface
36
     */
37
    protected $image;
38
39
    /**
40
     * @var ArticleInterface
41
     */
42
    protected $article;
43
44
    /**
45
     * @var string
46
     */
47
    protected $description;
48
49
    /**
50
     * @var string
51
     */
52
    protected $located;
53
54
    /**
55
     * @var string
56
     */
57
    protected $byLine;
58
59
    /**
60
     * @var string
61
     */
62
    protected $body;
63
64
    /**
65
     * @var string
66
     */
67
    protected $mimetype;
68
69
    /**
70
     * @var string
71
     */
72
    protected $usageTerms;
73
74
    /**
75
     * {@inheritdoc}
76
     */
77 4
    public function getId()
78
    {
79 4
        return $this->id;
80
    }
81
82
    /**
83
     * {@inheritdoc}
84
     */
85
    public function getFile()
86
    {
87
        return $this->file;
88
    }
89
90
    /**
91
     * @param FileInterface $file
92
     *
93
     * @return ArticleMedia
94
     */
95
    public function setFile($file)
96
    {
97
        $this->file = $file;
98
99
        return $this;
100
    }
101
102
    /**
103
     * {@inheritdoc}
104
     */
105 1
    public function getImage()
106
    {
107 1
        return $this->image;
108
    }
109
110
    /**
111
     * @param ImageInterface $image
112
     *
113
     * @return ArticleMedia
114
     */
115 5
    public function setImage($image)
116
    {
117 5
        $this->image = $image;
118
119 5
        return $this;
120
    }
121
122
    /**
123
     * {@inheritdoc}
124
     */
125
    public function getArticle()
126
    {
127
        return $this->article;
128
    }
129
130
    /**
131
     * @param ArticleInterface $article
132
     *
133
     * @return ArticleMedia
134
     */
135 6
    public function setArticle(ArticleInterface $article)
136
    {
137 6
        $this->article = $article;
138
139 6
        return $this;
140
    }
141
142
    /**
143
     * {@inheritdoc}
144
     */
145 2
    public function getDescription()
146
    {
147 2
        return $this->description;
148
    }
149
150
    /**
151
     * @param string $description
152
     *
153
     * @return ArticleMedia
154
     */
155 6
    public function setDescription($description)
156
    {
157 6
        $this->description = $description;
158
159 6
        return $this;
160
    }
161
162
    /**
163
     * {@inheritdoc}
164
     */
165 2
    public function getLocated()
166
    {
167 2
        return $this->located;
168
    }
169
170
    /**
171
     * @param string $located
172
     *
173
     * @return ArticleMedia
174
     */
175 6
    public function setLocated($located)
176
    {
177 6
        $this->located = $located;
178
179 6
        return $this;
180
    }
181
182
    /**
183
     * {@inheritdoc}
184
     */
185 2
    public function getByLine()
186
    {
187 2
        return $this->byLine;
188
    }
189
190
    /**
191
     * @param string $byLine
192
     *
193
     * @return ArticleMedia
194
     */
195 6
    public function setByLine($byLine)
196
    {
197 6
        $this->byLine = $byLine;
198
199 6
        return $this;
200
    }
201
202
    /**
203
     * {@inheritdoc}
204
     */
205 2
    public function getBody()
206
    {
207 2
        return $this->body;
208
    }
209
210
    /**
211
     * @param string $body
212
     *
213
     * @return ArticleMedia
214
     */
215 6
    public function setBody($body)
216
    {
217 6
        $this->body = $body;
218
219 6
        return $this;
220
    }
221
222
    /**
223
     * @return string
224
     */
225 2
    public function getMimetype()
226
    {
227 2
        return $this->mimetype;
228
    }
229
230
    /**
231
     * @param string $mimetype
232
     *
233
     * @return ArticleMedia
234
     */
235 5
    public function setMimetype($mimetype)
236
    {
237 5
        $this->mimetype = $mimetype;
238
239 5
        return $this;
240
    }
241
242
    /**
243
     * @return mixed
244
     */
245 2
    public function getUsageTerms()
246
    {
247 2
        return $this->usageTerms;
248
    }
249
250
    /**
251
     * @param mixed $usageTerms
252
     *
253
     * @return ArticleMedia
254
     */
255 6
    public function setUsageTerms($usageTerms)
256
    {
257 6
        $this->usageTerms = $usageTerms;
258
259 6
        return $this;
260
    }
261
262
    /**
263
     * @param ItemInterface $item
264
     */
265 4
    public function setFromItem(ItemInterface $item)
266
    {
267 4
        $this->setBody($item->getBody() ?: $item->getBodyText());
268 4
        $this->setByLine($item->getByLine());
269 4
        $this->setLocated($item->getLocated());
270 4
        $this->setDescription($item->getDescription());
271 4
        $this->setUsageTerms($item->getUsageTerms());
272 4
    }
273
}
274