You are here

public function Entry::getAuthors in Zircon Profile 8.0

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

Get an array with feed authors

Return value

array

1 call to Entry::getAuthors()
Entry::getAuthor in vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Entry.php
Get an author entry

File

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

Class

Entry

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()
    ->evaluate($this
    ->getXpathPrefix() . '//dc11:creator');
  if (!$list->length) {
    $list = $this
      ->getXpath()
      ->evaluate($this
      ->getXpathPrefix() . '//dc10:creator');
  }
  if (!$list->length) {
    $list = $this
      ->getXpath()
      ->evaluate($this
      ->getXpathPrefix() . '//dc11:publisher');
    if (!$list->length) {
      $list = $this
        ->getXpath()
        ->evaluate($this
        ->getXpathPrefix() . '//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'];
}