Mercurial > hg > cmmr2012-drupal-site
comparison vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php @ 2:5311817fb629
Theme updates
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 13:19:18 +0000 |
parents | c75dbcec494b |
children | a9cd425dd02b |
comparison
equal
deleted
inserted
replaced
1:0b0e5f3b1e83 | 2:5311817fb629 |
---|---|
59 * @return AbstractFeed | 59 * @return AbstractFeed |
60 */ | 60 */ |
61 public function addAuthor(array $author) | 61 public function addAuthor(array $author) |
62 { | 62 { |
63 // Check array values | 63 // Check array values |
64 if (!array_key_exists('name', $author) | 64 if (! array_key_exists('name', $author) |
65 || empty($author['name']) | 65 || empty($author['name']) |
66 || !is_string($author['name']) | 66 || ! is_string($author['name']) |
67 ) { | 67 ) { |
68 throw new Exception\InvalidArgumentException( | 68 throw new Exception\InvalidArgumentException( |
69 'Invalid parameter: author array must include a "name" key with a non-empty string value'); | 69 'Invalid parameter: author array must include a "name" key with a non-empty string value' |
70 ); | |
70 } | 71 } |
71 | 72 |
72 if (isset($author['email'])) { | 73 if (isset($author['email'])) { |
73 if (empty($author['email']) || !is_string($author['email'])) { | 74 if (empty($author['email']) || ! is_string($author['email'])) { |
74 throw new Exception\InvalidArgumentException( | 75 throw new Exception\InvalidArgumentException( |
75 'Invalid parameter: "email" array value must be a non-empty string'); | 76 'Invalid parameter: "email" array value must be a non-empty string' |
77 ); | |
76 } | 78 } |
77 } | 79 } |
78 if (isset($author['uri'])) { | 80 if (isset($author['uri'])) { |
79 if (empty($author['uri']) || !is_string($author['uri']) || | 81 if (empty($author['uri']) || ! is_string($author['uri']) || |
80 !Uri::factory($author['uri'])->isValid() | 82 ! Uri::factory($author['uri'])->isValid() |
81 ) { | 83 ) { |
82 throw new Exception\InvalidArgumentException( | 84 throw new Exception\InvalidArgumentException( |
83 'Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); | 85 'Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI' |
86 ); | |
84 } | 87 } |
85 } | 88 } |
86 | 89 |
87 $this->data['authors'][] = $author; | 90 $this->data['authors'][] = $author; |
88 | 91 |
112 * @throws Exception\InvalidArgumentException | 115 * @throws Exception\InvalidArgumentException |
113 * @return AbstractFeed | 116 * @return AbstractFeed |
114 */ | 117 */ |
115 public function setCopyright($copyright) | 118 public function setCopyright($copyright) |
116 { | 119 { |
117 if (empty($copyright) || !is_string($copyright)) { | 120 if (empty($copyright) || ! is_string($copyright)) { |
118 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); | 121 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); |
119 } | 122 } |
120 $this->data['copyright'] = $copyright; | 123 $this->data['copyright'] = $copyright; |
121 | 124 |
122 return $this; | 125 return $this; |
133 { | 136 { |
134 if ($date === null) { | 137 if ($date === null) { |
135 $date = new DateTime(); | 138 $date = new DateTime(); |
136 } elseif (is_int($date)) { | 139 } elseif (is_int($date)) { |
137 $date = new DateTime('@' . $date); | 140 $date = new DateTime('@' . $date); |
138 } elseif (!$date instanceof DateTime) { | 141 } elseif (! $date instanceof DateTime) { |
139 throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' | 142 throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' |
140 . ' passed as parameter'); | 143 . ' passed as parameter'); |
141 } | 144 } |
142 $this->data['dateCreated'] = $date; | 145 $this->data['dateCreated'] = $date; |
143 | 146 |
155 { | 158 { |
156 if ($date === null) { | 159 if ($date === null) { |
157 $date = new DateTime(); | 160 $date = new DateTime(); |
158 } elseif (is_int($date)) { | 161 } elseif (is_int($date)) { |
159 $date = new DateTime('@' . $date); | 162 $date = new DateTime('@' . $date); |
160 } elseif (!$date instanceof DateTime) { | 163 } elseif (! $date instanceof DateTime) { |
161 throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' | 164 throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' |
162 . ' passed as parameter'); | 165 . ' passed as parameter'); |
163 } | 166 } |
164 $this->data['dateModified'] = $date; | 167 $this->data['dateModified'] = $date; |
165 | 168 |
177 { | 180 { |
178 if ($date === null) { | 181 if ($date === null) { |
179 $date = new DateTime(); | 182 $date = new DateTime(); |
180 } elseif (is_int($date)) { | 183 } elseif (is_int($date)) { |
181 $date = new DateTime('@' . $date); | 184 $date = new DateTime('@' . $date); |
182 } elseif (!$date instanceof DateTime) { | 185 } elseif (! $date instanceof DateTime) { |
183 throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' | 186 throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' |
184 . ' passed as parameter'); | 187 . ' passed as parameter'); |
185 } | 188 } |
186 $this->data['lastBuildDate'] = $date; | 189 $this->data['lastBuildDate'] = $date; |
187 | 190 |
195 * @throws Exception\InvalidArgumentException | 198 * @throws Exception\InvalidArgumentException |
196 * @return AbstractFeed | 199 * @return AbstractFeed |
197 */ | 200 */ |
198 public function setDescription($description) | 201 public function setDescription($description) |
199 { | 202 { |
200 if (empty($description) || !is_string($description)) { | 203 if (empty($description) || ! is_string($description)) { |
201 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); | 204 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); |
202 } | 205 } |
203 $this->data['description'] = $description; | 206 $this->data['description'] = $description; |
204 | 207 |
205 return $this; | 208 return $this; |
216 */ | 219 */ |
217 public function setGenerator($name, $version = null, $uri = null) | 220 public function setGenerator($name, $version = null, $uri = null) |
218 { | 221 { |
219 if (is_array($name)) { | 222 if (is_array($name)) { |
220 $data = $name; | 223 $data = $name; |
221 if (empty($data['name']) || !is_string($data['name'])) { | 224 if (empty($data['name']) || ! is_string($data['name'])) { |
222 throw new Exception\InvalidArgumentException('Invalid parameter: "name" must be a non-empty string'); | 225 throw new Exception\InvalidArgumentException('Invalid parameter: "name" must be a non-empty string'); |
223 } | 226 } |
224 $generator = ['name' => $data['name']]; | 227 $generator = ['name' => $data['name']]; |
225 if (isset($data['version'])) { | 228 if (isset($data['version'])) { |
226 if (empty($data['version']) || !is_string($data['version'])) { | 229 if (empty($data['version']) || ! is_string($data['version'])) { |
227 throw new Exception\InvalidArgumentException('Invalid parameter: "version" must be a non-empty string'); | 230 throw new Exception\InvalidArgumentException( |
231 'Invalid parameter: "version" must be a non-empty string' | |
232 ); | |
228 } | 233 } |
229 $generator['version'] = $data['version']; | 234 $generator['version'] = $data['version']; |
230 } | 235 } |
231 if (isset($data['uri'])) { | 236 if (isset($data['uri'])) { |
232 if (empty($data['uri']) || !is_string($data['uri']) || !Uri::factory($data['uri'])->isValid()) { | 237 if (empty($data['uri']) || ! is_string($data['uri']) || ! Uri::factory($data['uri'])->isValid()) { |
233 throw new Exception\InvalidArgumentException('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); | 238 throw new Exception\InvalidArgumentException( |
239 'Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI' | |
240 ); | |
234 } | 241 } |
235 $generator['uri'] = $data['uri']; | 242 $generator['uri'] = $data['uri']; |
236 } | 243 } |
237 } else { | 244 } else { |
238 if (empty($name) || !is_string($name)) { | 245 if (empty($name) || ! is_string($name)) { |
239 throw new Exception\InvalidArgumentException('Invalid parameter: "name" must be a non-empty string'); | 246 throw new Exception\InvalidArgumentException('Invalid parameter: "name" must be a non-empty string'); |
240 } | 247 } |
241 $generator = ['name' => $name]; | 248 $generator = ['name' => $name]; |
242 if (isset($version)) { | 249 if (isset($version)) { |
243 if (empty($version) || !is_string($version)) { | 250 if (empty($version) || ! is_string($version)) { |
244 throw new Exception\InvalidArgumentException('Invalid parameter: "version" must be a non-empty string'); | 251 throw new Exception\InvalidArgumentException( |
252 'Invalid parameter: "version" must be a non-empty string' | |
253 ); | |
245 } | 254 } |
246 $generator['version'] = $version; | 255 $generator['version'] = $version; |
247 } | 256 } |
248 if (isset($uri)) { | 257 if (isset($uri)) { |
249 if (empty($uri) || !is_string($uri) || !Uri::factory($uri)->isValid()) { | 258 if (empty($uri) || ! is_string($uri) || ! Uri::factory($uri)->isValid()) { |
250 throw new Exception\InvalidArgumentException('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); | 259 throw new Exception\InvalidArgumentException( |
260 'Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI' | |
261 ); | |
251 } | 262 } |
252 $generator['uri'] = $uri; | 263 $generator['uri'] = $uri; |
253 } | 264 } |
254 } | 265 } |
255 $this->data['generator'] = $generator; | 266 $this->data['generator'] = $generator; |
264 * @throws Exception\InvalidArgumentException | 275 * @throws Exception\InvalidArgumentException |
265 * @return AbstractFeed | 276 * @return AbstractFeed |
266 */ | 277 */ |
267 public function setId($id) | 278 public function setId($id) |
268 { | 279 { |
269 if ((empty($id) || !is_string($id) || !Uri::factory($id)->isValid()) | 280 // @codingStandardsIgnoreStart |
270 && !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id) | 281 if ((empty($id) || ! is_string($id) || ! Uri::factory($id)->isValid()) |
271 && !$this->_validateTagUri($id) | 282 && ! preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id) |
283 && ! $this->_validateTagUri($id) | |
272 ) { | 284 ) { |
273 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); | 285 // @codingStandardsIgnoreEnd |
286 throw new Exception\InvalidArgumentException( | |
287 'Invalid parameter: parameter must be a non-empty string and valid URI/IRI' | |
288 ); | |
274 } | 289 } |
275 $this->data['id'] = $id; | 290 $this->data['id'] = $id; |
276 | 291 |
277 return $this; | 292 return $this; |
278 } | 293 } |
281 * Validate a URI using the tag scheme (RFC 4151) | 296 * Validate a URI using the tag scheme (RFC 4151) |
282 * | 297 * |
283 * @param string $id | 298 * @param string $id |
284 * @return bool | 299 * @return bool |
285 */ | 300 */ |
301 // @codingStandardsIgnoreStart | |
286 protected function _validateTagUri($id) | 302 protected function _validateTagUri($id) |
287 { | 303 { |
288 if (preg_match('/^tag:(?P<name>.*),(?P<date>\d{4}-?\d{0,2}-?\d{0,2}):(?P<specific>.*)(.*:)*$/', $id, $matches)) { | 304 // @codingStandardsIgnoreEnd |
305 if (preg_match( | |
306 '/^tag:(?P<name>.*),(?P<date>\d{4}-?\d{0,2}-?\d{0,2}):(?P<specific>.*)(.*:)*$/', | |
307 $id, | |
308 $matches | |
309 )) { | |
289 $dvalid = false; | 310 $dvalid = false; |
290 $date = $matches['date']; | 311 $date = $matches['date']; |
291 $d6 = strtotime($date); | 312 $d6 = strtotime($date); |
292 if ((strlen($date) == 4) && $date <= date('Y')) { | 313 if ((strlen($date) == 4) && $date <= date('Y')) { |
293 $dvalid = true; | 314 $dvalid = true; |
317 * @throws Exception\InvalidArgumentException | 338 * @throws Exception\InvalidArgumentException |
318 * @return AbstractFeed | 339 * @return AbstractFeed |
319 */ | 340 */ |
320 public function setImage(array $data) | 341 public function setImage(array $data) |
321 { | 342 { |
322 if (empty($data['uri']) || !is_string($data['uri']) | 343 if (empty($data['uri']) || ! is_string($data['uri']) |
323 || !Uri::factory($data['uri'])->isValid() | 344 || ! Uri::factory($data['uri'])->isValid() |
324 ) { | 345 ) { |
325 throw new Exception\InvalidArgumentException('Invalid parameter: parameter \'uri\'' | 346 throw new Exception\InvalidArgumentException('Invalid parameter: parameter \'uri\'' |
326 . ' must be a non-empty string and valid URI/IRI'); | 347 . ' must be a non-empty string and valid URI/IRI'); |
327 } | 348 } |
328 $this->data['image'] = $data; | 349 $this->data['image'] = $data; |
337 * @throws Exception\InvalidArgumentException | 358 * @throws Exception\InvalidArgumentException |
338 * @return AbstractFeed | 359 * @return AbstractFeed |
339 */ | 360 */ |
340 public function setLanguage($language) | 361 public function setLanguage($language) |
341 { | 362 { |
342 if (empty($language) || !is_string($language)) { | 363 if (empty($language) || ! is_string($language)) { |
343 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); | 364 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); |
344 } | 365 } |
345 $this->data['language'] = $language; | 366 $this->data['language'] = $language; |
346 | 367 |
347 return $this; | 368 return $this; |
354 * @throws Exception\InvalidArgumentException | 375 * @throws Exception\InvalidArgumentException |
355 * @return AbstractFeed | 376 * @return AbstractFeed |
356 */ | 377 */ |
357 public function setLink($link) | 378 public function setLink($link) |
358 { | 379 { |
359 if (empty($link) || !is_string($link) || !Uri::factory($link)->isValid()) { | 380 if (empty($link) || ! is_string($link) || ! Uri::factory($link)->isValid()) { |
360 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); | 381 throw new Exception\InvalidArgumentException( |
382 'Invalid parameter: parameter must be a non-empty string and valid URI/IRI' | |
383 ); | |
361 } | 384 } |
362 $this->data['link'] = $link; | 385 $this->data['link'] = $link; |
363 | 386 |
364 return $this; | 387 return $this; |
365 } | 388 } |
372 * @throws Exception\InvalidArgumentException | 395 * @throws Exception\InvalidArgumentException |
373 * @return AbstractFeed | 396 * @return AbstractFeed |
374 */ | 397 */ |
375 public function setFeedLink($link, $type) | 398 public function setFeedLink($link, $type) |
376 { | 399 { |
377 if (empty($link) || !is_string($link) || !Uri::factory($link)->isValid()) { | 400 if (empty($link) || ! is_string($link) || ! Uri::factory($link)->isValid()) { |
378 throw new Exception\InvalidArgumentException('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); | 401 throw new Exception\InvalidArgumentException( |
379 } | 402 'Invalid parameter: "link"" must be a non-empty string and valid URI/IRI' |
380 if (!in_array(strtolower($type), ['rss', 'rdf', 'atom'])) { | 403 ); |
381 throw new Exception\InvalidArgumentException('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); | 404 } |
405 if (! in_array(strtolower($type), ['rss', 'rdf', 'atom'])) { | |
406 throw new Exception\InvalidArgumentException( | |
407 'Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom' | |
408 ); | |
382 } | 409 } |
383 $this->data['feedLinks'][strtolower($type)] = $link; | 410 $this->data['feedLinks'][strtolower($type)] = $link; |
384 | 411 |
385 return $this; | 412 return $this; |
386 } | 413 } |
392 * @throws Exception\InvalidArgumentException | 419 * @throws Exception\InvalidArgumentException |
393 * @return AbstractFeed | 420 * @return AbstractFeed |
394 */ | 421 */ |
395 public function setTitle($title) | 422 public function setTitle($title) |
396 { | 423 { |
397 if (empty($title) || !is_string($title)) { | 424 if ((empty($title) && ! is_numeric($title)) || ! is_string($title)) { |
398 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); | 425 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); |
399 } | 426 } |
400 $this->data['title'] = $title; | 427 $this->data['title'] = $title; |
401 | 428 |
402 return $this; | 429 return $this; |
409 * @throws Exception\InvalidArgumentException | 436 * @throws Exception\InvalidArgumentException |
410 * @return AbstractFeed | 437 * @return AbstractFeed |
411 */ | 438 */ |
412 public function setEncoding($encoding) | 439 public function setEncoding($encoding) |
413 { | 440 { |
414 if (empty($encoding) || !is_string($encoding)) { | 441 if (empty($encoding) || ! is_string($encoding)) { |
415 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); | 442 throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); |
416 } | 443 } |
417 $this->data['encoding'] = $encoding; | 444 $this->data['encoding'] = $encoding; |
418 | 445 |
419 return $this; | 446 return $this; |
426 * @throws Exception\InvalidArgumentException | 453 * @throws Exception\InvalidArgumentException |
427 * @return AbstractFeed | 454 * @return AbstractFeed |
428 */ | 455 */ |
429 public function setBaseUrl($url) | 456 public function setBaseUrl($url) |
430 { | 457 { |
431 if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { | 458 if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { |
432 throw new Exception\InvalidArgumentException('Invalid parameter: "url" array value' | 459 throw new Exception\InvalidArgumentException('Invalid parameter: "url" array value' |
433 . ' must be a non-empty string and valid URI/IRI'); | 460 . ' must be a non-empty string and valid URI/IRI'); |
434 } | 461 } |
435 $this->data['baseUrl'] = $url; | 462 $this->data['baseUrl'] = $url; |
436 | 463 |
444 * @throws Exception\InvalidArgumentException | 471 * @throws Exception\InvalidArgumentException |
445 * @return AbstractFeed | 472 * @return AbstractFeed |
446 */ | 473 */ |
447 public function addHub($url) | 474 public function addHub($url) |
448 { | 475 { |
449 if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { | 476 if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { |
450 throw new Exception\InvalidArgumentException('Invalid parameter: "url" array value' | 477 throw new Exception\InvalidArgumentException('Invalid parameter: "url" array value' |
451 . ' must be a non-empty string and valid URI/IRI'); | 478 . ' must be a non-empty string and valid URI/IRI'); |
452 } | 479 } |
453 if (!isset($this->data['hubs'])) { | 480 if (! isset($this->data['hubs'])) { |
454 $this->data['hubs'] = []; | 481 $this->data['hubs'] = []; |
455 } | 482 } |
456 $this->data['hubs'][] = $url; | 483 $this->data['hubs'][] = $url; |
457 | 484 |
458 return $this; | 485 return $this; |
480 * @throws Exception\InvalidArgumentException | 507 * @throws Exception\InvalidArgumentException |
481 * @return AbstractFeed | 508 * @return AbstractFeed |
482 */ | 509 */ |
483 public function addCategory(array $category) | 510 public function addCategory(array $category) |
484 { | 511 { |
485 if (!isset($category['term'])) { | 512 if (! isset($category['term'])) { |
486 throw new Exception\InvalidArgumentException('Each category must be an array and ' | 513 throw new Exception\InvalidArgumentException('Each category must be an array and ' |
487 . 'contain at least a "term" element containing the machine ' | 514 . 'contain at least a "term" element containing the machine ' |
488 . ' readable category name'); | 515 . ' readable category name'); |
489 } | 516 } |
490 if (isset($category['scheme'])) { | 517 if (isset($category['scheme'])) { |
491 if (empty($category['scheme']) | 518 if (empty($category['scheme']) |
492 || !is_string($category['scheme']) | 519 || ! is_string($category['scheme']) |
493 || !Uri::factory($category['scheme'])->isValid() | 520 || ! Uri::factory($category['scheme'])->isValid() |
494 ) { | 521 ) { |
495 throw new Exception\InvalidArgumentException('The Atom scheme or RSS domain of' | 522 throw new Exception\InvalidArgumentException('The Atom scheme or RSS domain of' |
496 . ' a category must be a valid URI'); | 523 . ' a category must be a valid URI'); |
497 } | 524 } |
498 } | 525 } |
499 if (!isset($this->data['categories'])) { | 526 if (! isset($this->data['categories'])) { |
500 $this->data['categories'] = []; | 527 $this->data['categories'] = []; |
501 } | 528 } |
502 $this->data['categories'][] = $category; | 529 $this->data['categories'][] = $category; |
503 | 530 |
504 return $this; | 531 return $this; |
539 * | 566 * |
540 * @return array | 567 * @return array |
541 */ | 568 */ |
542 public function getAuthors() | 569 public function getAuthors() |
543 { | 570 { |
544 if (!array_key_exists('authors', $this->data)) { | 571 if (! array_key_exists('authors', $this->data)) { |
545 return; | 572 return; |
546 } | 573 } |
547 return $this->data['authors']; | 574 return $this->data['authors']; |
548 } | 575 } |
549 | 576 |
552 * | 579 * |
553 * @return string|null | 580 * @return string|null |
554 */ | 581 */ |
555 public function getCopyright() | 582 public function getCopyright() |
556 { | 583 { |
557 if (!array_key_exists('copyright', $this->data)) { | 584 if (! array_key_exists('copyright', $this->data)) { |
558 return; | 585 return; |
559 } | 586 } |
560 return $this->data['copyright']; | 587 return $this->data['copyright']; |
561 } | 588 } |
562 | 589 |
565 * | 592 * |
566 * @return string|null | 593 * @return string|null |
567 */ | 594 */ |
568 public function getDateCreated() | 595 public function getDateCreated() |
569 { | 596 { |
570 if (!array_key_exists('dateCreated', $this->data)) { | 597 if (! array_key_exists('dateCreated', $this->data)) { |
571 return; | 598 return; |
572 } | 599 } |
573 return $this->data['dateCreated']; | 600 return $this->data['dateCreated']; |
574 } | 601 } |
575 | 602 |
578 * | 605 * |
579 * @return string|null | 606 * @return string|null |
580 */ | 607 */ |
581 public function getDateModified() | 608 public function getDateModified() |
582 { | 609 { |
583 if (!array_key_exists('dateModified', $this->data)) { | 610 if (! array_key_exists('dateModified', $this->data)) { |
584 return; | 611 return; |
585 } | 612 } |
586 return $this->data['dateModified']; | 613 return $this->data['dateModified']; |
587 } | 614 } |
588 | 615 |
591 * | 618 * |
592 * @return string|null | 619 * @return string|null |
593 */ | 620 */ |
594 public function getLastBuildDate() | 621 public function getLastBuildDate() |
595 { | 622 { |
596 if (!array_key_exists('lastBuildDate', $this->data)) { | 623 if (! array_key_exists('lastBuildDate', $this->data)) { |
597 return; | 624 return; |
598 } | 625 } |
599 return $this->data['lastBuildDate']; | 626 return $this->data['lastBuildDate']; |
600 } | 627 } |
601 | 628 |
604 * | 631 * |
605 * @return string|null | 632 * @return string|null |
606 */ | 633 */ |
607 public function getDescription() | 634 public function getDescription() |
608 { | 635 { |
609 if (!array_key_exists('description', $this->data)) { | 636 if (! array_key_exists('description', $this->data)) { |
610 return; | 637 return; |
611 } | 638 } |
612 return $this->data['description']; | 639 return $this->data['description']; |
613 } | 640 } |
614 | 641 |
617 * | 644 * |
618 * @return string|null | 645 * @return string|null |
619 */ | 646 */ |
620 public function getGenerator() | 647 public function getGenerator() |
621 { | 648 { |
622 if (!array_key_exists('generator', $this->data)) { | 649 if (! array_key_exists('generator', $this->data)) { |
623 return; | 650 return; |
624 } | 651 } |
625 return $this->data['generator']; | 652 return $this->data['generator']; |
626 } | 653 } |
627 | 654 |
630 * | 657 * |
631 * @return string|null | 658 * @return string|null |
632 */ | 659 */ |
633 public function getId() | 660 public function getId() |
634 { | 661 { |
635 if (!array_key_exists('id', $this->data)) { | 662 if (! array_key_exists('id', $this->data)) { |
636 return; | 663 return; |
637 } | 664 } |
638 return $this->data['id']; | 665 return $this->data['id']; |
639 } | 666 } |
640 | 667 |
643 * | 670 * |
644 * @return array | 671 * @return array |
645 */ | 672 */ |
646 public function getImage() | 673 public function getImage() |
647 { | 674 { |
648 if (!array_key_exists('image', $this->data)) { | 675 if (! array_key_exists('image', $this->data)) { |
649 return; | 676 return; |
650 } | 677 } |
651 return $this->data['image']; | 678 return $this->data['image']; |
652 } | 679 } |
653 | 680 |
656 * | 683 * |
657 * @return string|null | 684 * @return string|null |
658 */ | 685 */ |
659 public function getLanguage() | 686 public function getLanguage() |
660 { | 687 { |
661 if (!array_key_exists('language', $this->data)) { | 688 if (! array_key_exists('language', $this->data)) { |
662 return; | 689 return; |
663 } | 690 } |
664 return $this->data['language']; | 691 return $this->data['language']; |
665 } | 692 } |
666 | 693 |
669 * | 696 * |
670 * @return string|null | 697 * @return string|null |
671 */ | 698 */ |
672 public function getLink() | 699 public function getLink() |
673 { | 700 { |
674 if (!array_key_exists('link', $this->data)) { | 701 if (! array_key_exists('link', $this->data)) { |
675 return; | 702 return; |
676 } | 703 } |
677 return $this->data['link']; | 704 return $this->data['link']; |
678 } | 705 } |
679 | 706 |
682 * | 709 * |
683 * @return string|null | 710 * @return string|null |
684 */ | 711 */ |
685 public function getFeedLinks() | 712 public function getFeedLinks() |
686 { | 713 { |
687 if (!array_key_exists('feedLinks', $this->data)) { | 714 if (! array_key_exists('feedLinks', $this->data)) { |
688 return; | 715 return; |
689 } | 716 } |
690 return $this->data['feedLinks']; | 717 return $this->data['feedLinks']; |
691 } | 718 } |
692 | 719 |
695 * | 722 * |
696 * @return string|null | 723 * @return string|null |
697 */ | 724 */ |
698 public function getTitle() | 725 public function getTitle() |
699 { | 726 { |
700 if (!array_key_exists('title', $this->data)) { | 727 if (! array_key_exists('title', $this->data)) { |
701 return; | 728 return; |
702 } | 729 } |
703 return $this->data['title']; | 730 return $this->data['title']; |
704 } | 731 } |
705 | 732 |
708 * | 735 * |
709 * @return string|null | 736 * @return string|null |
710 */ | 737 */ |
711 public function getEncoding() | 738 public function getEncoding() |
712 { | 739 { |
713 if (!array_key_exists('encoding', $this->data)) { | 740 if (! array_key_exists('encoding', $this->data)) { |
714 return 'UTF-8'; | 741 return 'UTF-8'; |
715 } | 742 } |
716 return $this->data['encoding']; | 743 return $this->data['encoding']; |
717 } | 744 } |
718 | 745 |
721 * | 748 * |
722 * @return string|null | 749 * @return string|null |
723 */ | 750 */ |
724 public function getBaseUrl() | 751 public function getBaseUrl() |
725 { | 752 { |
726 if (!array_key_exists('baseUrl', $this->data)) { | 753 if (! array_key_exists('baseUrl', $this->data)) { |
727 return; | 754 return; |
728 } | 755 } |
729 return $this->data['baseUrl']; | 756 return $this->data['baseUrl']; |
730 } | 757 } |
731 | 758 |
734 * | 761 * |
735 * @return string|null | 762 * @return string|null |
736 */ | 763 */ |
737 public function getHubs() | 764 public function getHubs() |
738 { | 765 { |
739 if (!array_key_exists('hubs', $this->data)) { | 766 if (! array_key_exists('hubs', $this->data)) { |
740 return; | 767 return; |
741 } | 768 } |
742 return $this->data['hubs']; | 769 return $this->data['hubs']; |
743 } | 770 } |
744 | 771 |
747 * | 774 * |
748 * @return string|null | 775 * @return string|null |
749 */ | 776 */ |
750 public function getCategories() | 777 public function getCategories() |
751 { | 778 { |
752 if (!array_key_exists('categories', $this->data)) { | 779 if (! array_key_exists('categories', $this->data)) { |
753 return; | 780 return; |
754 } | 781 } |
755 return $this->data['categories']; | 782 return $this->data['categories']; |
756 } | 783 } |
757 | 784 |
828 * Load extensions from Zend\Feed\Writer\Writer | 855 * Load extensions from Zend\Feed\Writer\Writer |
829 * | 856 * |
830 * @throws Exception\RuntimeException | 857 * @throws Exception\RuntimeException |
831 * @return void | 858 * @return void |
832 */ | 859 */ |
860 // @codingStandardsIgnoreStart | |
833 protected function _loadExtensions() | 861 protected function _loadExtensions() |
834 { | 862 { |
863 // @codingStandardsIgnoreEnd | |
835 $all = Writer::getExtensions(); | 864 $all = Writer::getExtensions(); |
836 $manager = Writer::getExtensionManager(); | 865 $manager = Writer::getExtensionManager(); |
837 $exts = $all['feed']; | 866 $exts = $all['feed']; |
838 foreach ($exts as $ext) { | 867 foreach ($exts as $ext) { |
839 if (!$manager->has($ext)) { | 868 if (! $manager->has($ext)) { |
840 throw new Exception\RuntimeException(sprintf('Unable to load extension "%s"; could not resolve to class', $ext)); | 869 throw new Exception\RuntimeException( |
870 sprintf('Unable to load extension "%s"; could not resolve to class', $ext) | |
871 ); | |
841 } | 872 } |
842 $this->extensions[$ext] = $manager->get($ext); | 873 $this->extensions[$ext] = $manager->get($ext); |
843 $this->extensions[$ext]->setEncoding($this->getEncoding()); | 874 $this->extensions[$ext]->setEncoding($this->getEncoding()); |
844 } | 875 } |
845 } | 876 } |