You are here

public function AbstractEntry::setType in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-feed/src/Reader/Extension/AbstractEntry.php \Zend\Feed\Reader\Extension\AbstractEntry::setType()

Set the entry type

Has side effect of setting xpath prefix

Parameters

string $type:

Return value

AbstractEntry

1 call to AbstractEntry::setType()
AbstractEntry::getType in vendor/zendframework/zend-feed/src/Reader/Extension/AbstractEntry.php
Get the entry type

File

vendor/zendframework/zend-feed/src/Reader/Extension/AbstractEntry.php, line 127

Class

AbstractEntry

Namespace

Zend\Feed\Reader\Extension

Code

public function setType($type) {
  if (null === $type) {
    $this->data['type'] = null;
    return $this;
  }
  $this->data['type'] = $type;
  if ($type === Reader\Reader::TYPE_RSS_10 || $type === Reader\Reader::TYPE_RSS_090) {
    $this
      ->setXpathPrefix('//rss:item[' . ($this->entryKey + 1) . ']');
    return $this;
  }
  if ($type === Reader\Reader::TYPE_ATOM_10 || $type === Reader\Reader::TYPE_ATOM_03) {
    $this
      ->setXpathPrefix('//atom:entry[' . ($this->entryKey + 1) . ']');
    return $this;
  }
  $this
    ->setXpathPrefix('//item[' . ($this->entryKey + 1) . ']');
  return $this;
}