/library/Zend/Feed/Reader/Extension/Thread/Entry.php
PHP | 91 lines | 29 code | 10 blank | 52 comment | 2 complexity | 317de492c31a5c80ba6422266b72dde9 MD5 | raw file
Possible License(s): AGPL-1.0
1<?php
2/**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Feed_Reader
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Entry.php 24594 2012-01-05 21:27:01Z matthew $
20 */
21
22/**
23 * @see Zend_Feed_Reader_Extension_EntryAbstract
24 */
25require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
26
27/**
28 * @category Zend
29 * @package Zend_Feed_Reader
30 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31 * @license http://framework.zend.com/license/new-bsd New BSD License
32 */
33class Zend_Feed_Reader_Extension_Thread_Entry
34 extends Zend_Feed_Reader_Extension_EntryAbstract
35{
36 /**
37 * Get the "in-reply-to" value
38 *
39 * @return string
40 */
41 public function getInReplyTo()
42 {
43 // TODO: to be implemented
44 }
45
46 // TODO: Implement "replies" and "updated" constructs from standard
47
48 /**
49 * Get the total number of threaded responses (i.e comments)
50 *
51 * @return int|null
52 */
53 public function getCommentCount()
54 {
55 return $this->_getData('total');
56 }
57
58 /**
59 * Get the entry data specified by name
60 *
61 * @param string $name
62 * @param string $type
63 * @return mixed|null
64 */
65 protected function _getData($name)
66 {
67 if (array_key_exists($name, $this->_data)) {
68 return $this->_data[$name];
69 }
70
71 $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')');
72
73 if (!$data) {
74 $data = null;
75 }
76
77 $this->_data[$name] = $data;
78
79 return $data;
80 }
81
82 /**
83 * Register Atom Thread Extension 1.0 namespace
84 *
85 * @return void
86 */
87 protected function _registerNamespaces()
88 {
89 $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0');
90 }
91}