You are here

public function Entry::getDate in Zircon Profile 8

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

Return value

DateTime|null

File

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

Class

Entry

Namespace

Zend\Feed\Reader\Extension\DublinCore

Code

public function getDate() {
  if (array_key_exists('date', $this->data)) {
    return $this->data['date'];
  }
  $d = null;
  $date = $this
    ->getXpath()
    ->evaluate('string(' . $this
    ->getXpathPrefix() . '/dc11:date)');
  if (!$date) {
    $date = $this
      ->getXpath()
      ->evaluate('string(' . $this
      ->getXpathPrefix() . '/dc10:date)');
  }
  if ($date) {
    $d = new DateTime($date);
  }
  $this->data['date'] = $d;
  return $this->data['date'];
}