Completed
Pull Request — master (#255)
by
unknown
01:46
created

Media::setNodeName()   A

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 declare(strict_types=1);
2
/*
3
 * This file is part of the feed-io package.
4
 *
5
 * (c) Alexandre Debril <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace FeedIo\Feed\Item;
12
13
class Media implements MediaInterface
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $nodeName;
19
20
    /**
21
     * @var string
22
     */
23
    protected $type;
24
25
    /**
26
     * @var string
27
     */
28
    protected $url;
29
30
    /**
31
     * @var string
32
     */
33
    protected $length;
34
35
    /**
36
     * @var string
37
     */
38
    protected $title;
39
40
    /**
41
     * @var string
42
     */
43
    protected $description;
44
45
    /**
46
     * @var string
47
     */
48
    protected $thumbnail;
49
50
51
    /**
52
     * @return string
53
     */
54
    public function getNodeName() : string
55
    {
56
        return $this->nodeName;
57
    }
58
59
    /**
60
     * @param string $nodeName
61
     * @return MediaInterface
62
     */
63 5
    public function setNodeName(string $nodeName) : MediaInterface
64
    {
65 5
        $this->nodeName = $nodeName;
66
67 5
        return $this;
68
    }
69
70
    /**
71
     * @deprecated
72
     * @return bool
73
     */
74
    public function isThumbnail() : bool
75
    {
76
        trigger_error('Method isThumbnail is deprecated and will be removed in feed-io 5.0', E_USER_DEPRECATED);
77
        return $this->nodeName === 'media:thumbnail';
78
    }
79
80
    /**
81
     * @return string
82
     */
83 5
    public function getType() : ? string
84
    {
85 5
        return $this->type;
86
    }
87
88
    /**
89
     * @param  string $type
90
     * @return MediaInterface
91
     */
92 7
    public function setType(?string $type) : MediaInterface
93
    {
94 7
        $this->type = $type;
95
96 7
        return $this;
97
    }
98
99
    /**
100
     * @return string
101
     */
102 7
    public function getUrl() : ? string
103
    {
104 7
        return $this->url;
105
    }
106
107
    /**
108
     * @param  string $url
109
     * @return MediaInterface
110
     */
111 7
    public function setUrl(?string $url) : MediaInterface
112
    {
113 7
        $this->url = $url;
114
115 7
        return $this;
116
    }
117
118
    /**
119
     * @return string
120
     */
121 3
    public function getLength() : ? string
122
    {
123 3
        return $this->length;
124
    }
125
126
    /**
127
     * @param  string $length
128
     * @return MediaInterface
129
     */
130 6
    public function setLength(?string $length) : MediaInterface
131
    {
132 6
        $this->length = $length;
133
134 6
        return $this;
135
    }
136
137
138
    /**
139
     * @return string
140
     */
141 1
    public function getTitle() : ? string
142
    {
143 1
        return $this->title;
144
    }
145
146
    /**
147
     * @param  string $title
148
     * @return MediaInterface
149
     */
150 1
    public function setTitle(?string $title) : MediaInterface
151
    {
152 1
        $this->title = $title;
153
154 1
        return $this;
155
    }
156
157
    /**
158
     * @return string
159
     */
160 1
    public function getDescription() : ? string
161
    {
162 1
        return $this->description;
163
    }
164
165
    /**
166
     * @param  string $description
167
     * @return MediaInterface
168
     */
169 1
    public function setDescription(?string $description) : MediaInterface
170
    {
171 1
        $this->description = $description;
172
173 1
        return $this;
174
    }
175
176
    /**
177
     * @return string
178
     */
179 1
    public function getThumbnail() : ? string
180
    {
181 1
        return $this->thumbnail;
182
    }
183
184
    /**
185
     * @param  string $thumbnail
186
     * @return MediaInterface
187
     */
188 1
    public function setThumbnail(?string $thumbnail) : MediaInterface
189
    {
190 1
        $this->thumbnail = $thumbnail;
191
192 1
        return $this;
193
    }
194
}
195