You are here

public function Feed::getAuthors in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php \Zend\Feed\Reader\Extension\Atom\Feed::getAuthors()
  2. 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php \Zend\Feed\Reader\Extension\DublinCore\Feed::getAuthors()
Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php \Zend\Feed\Reader\Extension\DublinCore\Feed::getAuthors()

Get an array with feed authors

Return value

array

1 call to Feed::getAuthors()
Feed::getAuthor in vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php
Get a single author

File

vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php, line 41

Class

Feed

Namespace

Zend\Feed\Reader\Extension\DublinCore

Code

public function getAuthors() {
  if (array_key_exists('authors', $this->data)) {
    return $this->data['authors'];
  }
  $authors = [];
  $list = $this
    ->getXpath()
    ->query('//dc11:creator');
  if (!$list->length) {
    $list = $this
      ->getXpath()
      ->query('//dc10:creator');
  }
  if (!$list->length) {
    $list = $this
      ->getXpath()
      ->query('//dc11:publisher');
    if (!$list->length) {
      $list = $this
        ->getXpath()
        ->query('//dc10:publisher');
    }
  }
  if ($list->length) {
    foreach ($list as $author) {
      $authors[] = [
        'name' => $author->nodeValue,
      ];
    }
    $authors = new Collection\Author(Reader\Reader::arrayUnique($authors));
  }
  else {
    $authors = null;
  }
  $this->data['authors'] = $authors;
  return $this->data['authors'];
}