You are here

protected function AtomDeleted::_setBy in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/AtomDeleted.php \Zend\Feed\Writer\Renderer\Entry\AtomDeleted::_setBy()

Set entry authors

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

1 call to AtomDeleted::_setBy()
AtomDeleted::render in vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/AtomDeleted.php
Render atom entry

File

vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/AtomDeleted.php, line 79

Class

AtomDeleted

Namespace

Zend\Feed\Writer\Renderer\Entry

Code

protected function _setBy(DOMDocument $dom, DOMElement $root) {
  $data = $this->container
    ->getBy();
  if (!$data || empty($data)) {
    return;
  }
  $author = $this->dom
    ->createElement('at:by');
  $name = $this->dom
    ->createElement('name');
  $author
    ->appendChild($name);
  $root
    ->appendChild($author);
  $text = $dom
    ->createTextNode($data['name']);
  $name
    ->appendChild($text);
  if (array_key_exists('email', $data)) {
    $email = $this->dom
      ->createElement('email');
    $author
      ->appendChild($email);
    $text = $dom
      ->createTextNode($data['email']);
    $email
      ->appendChild($text);
  }
  if (array_key_exists('uri', $data)) {
    $uri = $this->dom
      ->createElement('uri');
    $author
      ->appendChild($uri);
    $text = $dom
      ->createTextNode($data['uri']);
    $uri
      ->appendChild($text);
  }
}