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/Atom/Feed.php \Zend\Feed\Reader\Extension\Atom\Feed::getAuthors()

Get an array with feed authors

Return value

Collection\Author

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

File

vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php, line 43

Class

Feed

Namespace

Zend\Feed\Reader\Extension\Atom

Code

public function getAuthors() {
  if (array_key_exists('authors', $this->data)) {
    return $this->data['authors'];
  }
  $list = $this->xpath
    ->query('//atom:author');
  $authors = [];
  if ($list->length) {
    foreach ($list as $author) {
      $author = $this
        ->getAuthorFromElement($author);
      if (!empty($author)) {
        $authors[] = $author;
      }
    }
  }
  if (count($authors) == 0) {
    $authors = new Collection\Author();
  }
  else {
    $authors = new Collection\Author(Reader\Reader::arrayUnique($authors));
  }
  $this->data['authors'] = $authors;
  return $this->data['authors'];
}