3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Feed\Reader\Extension\Slash;
12 use Zend\Feed\Reader\Extension;
16 class Entry extends Extension\AbstractEntry
19 * Get the entry section
23 public function getSection()
25 return $this->getData('section');
29 * Get the entry department
33 public function getDepartment()
35 return $this->getData('department');
39 * Get the entry hit_parade
43 public function getHitParade()
47 if (isset($this->data[$name])) {
48 return $this->data[$name];
51 $stringParade = $this->getData($name);
54 if (! empty($stringParade)) {
55 $stringParade = explode(',', $stringParade);
57 foreach ($stringParade as $hit) {
58 $hitParade[] = $hit + 0; //cast to integer
62 $this->data[$name] = $hitParade;
67 * Get the entry comments
71 public function getCommentCount()
75 if (isset($this->data[$name])) {
76 return $this->data[$name];
79 $comments = $this->getData($name, 'string');
82 $this->data[$name] = null;
83 return $this->data[$name];
90 * Get the entry data specified by name
96 protected function getData($name, $type = 'string')
98 if (array_key_exists($name, $this->data)) {
99 return $this->data[$name];
102 $data = $this->xpath->evaluate($type . '(' . $this->getXpathPrefix() . '/slash10:' . $name . ')');
108 $this->data[$name] = $data;
114 * Register Slash namespaces
118 protected function registerNamespaces()
120 $this->xpath->registerNamespace('slash10', 'http://purl.org/rss/1.0/modules/slash/');