You are here

public function Entry::getDateCreated in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-feed/src/Writer/Entry.php \Zend\Feed\Writer\Entry::getDateCreated()
  2. 8 vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php \Zend\Feed\Reader\Extension\Atom\Entry::getDateCreated()
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::getDateCreated()

Get the entry creation date

Return value

string

File

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

Class

Entry

Namespace

Zend\Feed\Reader\Extension\Atom

Code

public function getDateCreated() {
  if (array_key_exists('datecreated', $this->data)) {
    return $this->data['datecreated'];
  }
  $date = null;
  if ($this
    ->getAtomType() === Reader\Reader::TYPE_ATOM_03) {
    $dateCreated = $this
      ->getXpath()
      ->evaluate('string(' . $this
      ->getXpathPrefix() . '/atom:created)');
  }
  else {
    $dateCreated = $this
      ->getXpath()
      ->evaluate('string(' . $this
      ->getXpathPrefix() . '/atom:published)');
  }
  if ($dateCreated) {
    $date = new DateTime($dateCreated);
  }
  $this->data['datecreated'] = $date;
  return $this->data['datecreated'];
}