You are here

protected function Entry::getAuthorFromElement in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php \Zend\Feed\Reader\Extension\Atom\Entry::getAuthorFromElement()

Get an author entry

Parameters

DOMElement $element:

Return value

string

1 call to Entry::getAuthorFromElement()
Entry::getAuthors in vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php
Get an array with feed authors

File

vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php, line 574

Class

Entry

Namespace

Zend\Feed\Reader\Extension\Atom

Code

protected function getAuthorFromElement(DOMElement $element) {
  $author = [];
  $emailNode = $element
    ->getElementsByTagName('email');
  $nameNode = $element
    ->getElementsByTagName('name');
  $uriNode = $element
    ->getElementsByTagName('uri');
  if ($emailNode->length && strlen($emailNode
    ->item(0)->nodeValue) > 0) {
    $author['email'] = $emailNode
      ->item(0)->nodeValue;
  }
  if ($nameNode->length && strlen($nameNode
    ->item(0)->nodeValue) > 0) {
    $author['name'] = $nameNode
      ->item(0)->nodeValue;
  }
  if ($uriNode->length && strlen($uriNode
    ->item(0)->nodeValue) > 0) {
    $author['uri'] = $uriNode
      ->item(0)->nodeValue;
  }
  if (empty($author)) {
    return;
  }
  return $author;
}