composer package updates
[openemr.git] / vendor / zendframework / zend-feed / src / Reader / Extension / GooglePlayPodcast / Feed.php
blob94fef58f9c4c0ce0411fd59d616b5c12cd1ed276
1 <?php
2 /**
3 * @see https://github.com/zendframework/zend-feed for the canonical source repository
4 * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
5 * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License
6 */
8 namespace Zend\Feed\Reader\Extension\GooglePlayPodcast;
10 use DOMText;
11 use Zend\Feed\Reader\Extension;
13 class Feed extends Extension\AbstractFeed
15 /**
16 * Get the entry author
18 * @return string
20 public function getPlayPodcastAuthor()
22 if (isset($this->data['author'])) {
23 return $this->data['author'];
26 $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:author)');
28 if (! $author) {
29 $author = null;
32 $this->data['author'] = $author;
34 return $this->data['author'];
37 /**
38 * Get the entry block
40 * @return string
42 public function getPlayPodcastBlock()
44 if (isset($this->data['block'])) {
45 return $this->data['block'];
48 $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:block)');
50 if (! $block) {
51 $block = null;
54 $this->data['block'] = $block;
56 return $this->data['block'];
59 /**
60 * Get the entry category
62 * @return array|null
64 public function getPlayPodcastCategories()
66 if (isset($this->data['categories'])) {
67 return $this->data['categories'];
70 $categoryList = $this->xpath->query($this->getXpathPrefix() . '/googleplay:category');
72 $categories = [];
74 if ($categoryList->length > 0) {
75 foreach ($categoryList as $node) {
76 $children = null;
78 if ($node->childNodes->length > 0) {
79 $children = [];
81 foreach ($node->childNodes as $childNode) {
82 if (! ($childNode instanceof DOMText)) {
83 $children[$childNode->getAttribute('text')] = null;
88 $categories[$node->getAttribute('text')] = $children;
92 if (! $categories) {
93 $categories = null;
96 $this->data['categories'] = $categories;
98 return $this->data['categories'];
102 * Get the entry explicit
104 * @return string
106 public function getPlayPodcastExplicit()
108 if (isset($this->data['explicit'])) {
109 return $this->data['explicit'];
112 $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:explicit)');
114 if (! $explicit) {
115 $explicit = null;
118 $this->data['explicit'] = $explicit;
120 return $this->data['explicit'];
124 * Get the feed/podcast image
126 * @return string
128 public function getPlayPodcastImage()
130 if (isset($this->data['image'])) {
131 return $this->data['image'];
134 $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:image/@href)');
136 if (! $image) {
137 $image = null;
140 $this->data['image'] = $image;
142 return $this->data['image'];
146 * Get the entry description
148 * @return string
150 public function getPlayPodcastDescription()
152 if (isset($this->data['description'])) {
153 return $this->data['description'];
156 $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:description)');
158 if (! $description) {
159 $description = null;
162 $this->data['description'] = $description;
164 return $this->data['description'];
168 * Register googleplay namespace
171 protected function registerNamespaces()
173 $this->xpath->registerNamespace('googleplay', 'http://www.google.com/schemas/play-podcasts/1.0');