comparison vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Entry.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 7a779792577d
children af1871eacc83
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
1 <?php 1 <?php
2 /** 2 /**
3 * Zend Framework (http://framework.zend.com/) 3 * @see https://github.com/zendframework/zend-feed for the canonical source repository
4 * 4 * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository 5 * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */ 6 */
9 7
10 namespace Zend\Feed\Reader\Extension\Podcast; 8 namespace Zend\Feed\Reader\Extension\Podcast;
11 9
12 use Zend\Feed\Reader\Extension; 10 use Zend\Feed\Reader\Extension;
13 11
14 /**
15 */
16 class Entry extends Extension\AbstractEntry 12 class Entry extends Extension\AbstractEntry
17 { 13 {
18 /** 14 /**
19 * Get the entry author 15 * Get the entry author
20 * 16 *
104 } 100 }
105 101
106 /** 102 /**
107 * Get the entry keywords 103 * Get the entry keywords
108 * 104 *
105 * @deprecated since 2.10.0; itunes:keywords is no longer part of the
106 * iTunes podcast RSS specification.
109 * @return string 107 * @return string
110 */ 108 */
111 public function getKeywords() 109 public function getKeywords()
112 { 110 {
111 trigger_error(
112 'itunes:keywords has been deprecated in the iTunes podcast RSS specification,'
113 . ' and should not be relied on.',
114 \E_USER_DEPRECATED
115 );
116
113 if (isset($this->data['keywords'])) { 117 if (isset($this->data['keywords'])) {
114 return $this->data['keywords']; 118 return $this->data['keywords'];
115 } 119 }
116 120
117 $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); 121 $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)');
168 172
169 return $this->data['summary']; 173 return $this->data['summary'];
170 } 174 }
171 175
172 /** 176 /**
177 * Get the entry image
178 *
179 * @return string
180 */
181 public function getItunesImage()
182 {
183 if (isset($this->data['image'])) {
184 return $this->data['image'];
185 }
186
187 $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)');
188
189 if (! $image) {
190 $image = null;
191 }
192
193 $this->data['image'] = $image;
194
195 return $this->data['image'];
196 }
197
198 /**
199 * Get the episode number
200 *
201 * @return null|int
202 */
203 public function getEpisode()
204 {
205 if (isset($this->data['episode'])) {
206 return $this->data['episode'];
207 }
208
209 $episode = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:episode)');
210
211 if (! $episode) {
212 $episode = null;
213 }
214
215 $this->data['episode'] = null === $episode ? $episode : (int) $episode;
216
217 return $this->data['episode'];
218 }
219
220 /**
221 * Get the episode number
222 *
223 * @return string One of "full", "trailer", or "bonus"; defaults to "full".
224 */
225 public function getEpisodeType()
226 {
227 if (isset($this->data['episodeType'])) {
228 return $this->data['episodeType'];
229 }
230
231 $type = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:episodeType)');
232
233 if (! $type) {
234 $type = 'full';
235 }
236
237 $this->data['episodeType'] = (string) $type;
238
239 return $this->data['episodeType'];
240 }
241
242 /**
243 * Is the episode closed captioned?
244 *
245 * Returns true only if itunes:isClosedCaptioned has the value 'Yes'.
246 *
247 * @return bool
248 */
249 public function isClosedCaptioned()
250 {
251 if (isset($this->data['isClosedCaptioned'])) {
252 return $this->data['isClosedCaptioned'];
253 }
254
255 $status = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:isClosedCaptioned)');
256
257 $this->data['isClosedCaptioned'] = $status === 'Yes';
258
259 return $this->data['isClosedCaptioned'];
260 }
261
262 /**
263 * Get the season number
264 *
265 * @return null|int
266 */
267 public function getSeason()
268 {
269 if (isset($this->data['season'])) {
270 return $this->data['season'];
271 }
272
273 $season = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:season)');
274
275 if (! $season) {
276 $season = null;
277 }
278
279 $this->data['season'] = null === $season ? $season : (int) $season;
280
281 return $this->data['season'];
282 }
283
284 /**
173 * Register iTunes namespace 285 * Register iTunes namespace
174 * 286 *
175 */ 287 */
176 protected function registerNamespaces() 288 protected function registerNamespaces()
177 { 289 {