You are here

public function Source::__construct in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/zendframework/zend-feed/src/Reader/Feed/Atom/Source.php \Zend\Feed\Reader\Feed\Atom\Source::__construct()
  2. 8.0 vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/Source.php \Zend\Feed\Writer\Renderer\Feed\Atom\Source::__construct()
Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-feed/src/Reader/Feed/Atom/Source.php \Zend\Feed\Reader\Feed\Atom\Source::__construct()

Constructor: Create a Source object which is largely just a normal Zend\Feed\Reader\AbstractFeed object only designed to retrieve feed level metadata from an Atom entry's source element.

Parameters

DOMElement $source:

string $xpathPrefix Passed from parent Entry object:

string $type Nearly always Atom 1.0:

File

vendor/zendframework/zend-feed/src/Reader/Feed/Atom/Source.php, line 30

Class

Source

Namespace

Zend\Feed\Reader\Feed\Atom

Code

public function __construct(DOMElement $source, $xpathPrefix, $type = Reader\Reader::TYPE_ATOM_10) {
  $this->domDocument = $source->ownerDocument;
  $this->xpath = new DOMXPath($this->domDocument);
  $this->data['type'] = $type;
  $this
    ->registerNamespaces();
  $this
    ->loadExtensions();
  $manager = Reader\Reader::getExtensionManager();
  $extensions = [
    'Atom\\Feed',
    'DublinCore\\Feed',
  ];
  foreach ($extensions as $name) {
    $extension = $manager
      ->get($name);
    $extension
      ->setDomDocument($this->domDocument);
    $extension
      ->setType($this->data['type']);
    $extension
      ->setXpath($this->xpath);
    $this->extensions[$name] = $extension;
  }
  foreach ($this->extensions as $extension) {
    $extension
      ->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source');
  }
}