Chris@0
|
1 <?php
|
Chris@0
|
2 /**
|
Chris@0
|
3 * Zend Framework (http://framework.zend.com/)
|
Chris@0
|
4 *
|
Chris@0
|
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
|
Chris@0
|
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
Chris@0
|
7 * @license http://framework.zend.com/license/new-bsd New BSD License
|
Chris@0
|
8 */
|
Chris@0
|
9
|
Chris@0
|
10 namespace Zend\Feed\Reader\Extension\Thread;
|
Chris@0
|
11
|
Chris@0
|
12 use Zend\Feed\Reader\Extension;
|
Chris@0
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 */
|
Chris@0
|
16 class Entry extends Extension\AbstractEntry
|
Chris@0
|
17 {
|
Chris@0
|
18 /**
|
Chris@0
|
19 * Get the "in-reply-to" value
|
Chris@0
|
20 *
|
Chris@0
|
21 * @return string
|
Chris@0
|
22 */
|
Chris@0
|
23 public function getInReplyTo()
|
Chris@0
|
24 {
|
Chris@0
|
25 // TODO: to be implemented
|
Chris@0
|
26 }
|
Chris@0
|
27
|
Chris@0
|
28 // TODO: Implement "replies" and "updated" constructs from standard
|
Chris@0
|
29
|
Chris@0
|
30 /**
|
Chris@0
|
31 * Get the total number of threaded responses (i.e comments)
|
Chris@0
|
32 *
|
Chris@0
|
33 * @return int|null
|
Chris@0
|
34 */
|
Chris@0
|
35 public function getCommentCount()
|
Chris@0
|
36 {
|
Chris@0
|
37 return $this->getData('total');
|
Chris@0
|
38 }
|
Chris@0
|
39
|
Chris@0
|
40 /**
|
Chris@0
|
41 * Get the entry data specified by name
|
Chris@0
|
42 *
|
Chris@0
|
43 * @param string $name
|
Chris@0
|
44 * @return mixed|null
|
Chris@0
|
45 */
|
Chris@0
|
46 protected function getData($name)
|
Chris@0
|
47 {
|
Chris@0
|
48 if (array_key_exists($name, $this->data)) {
|
Chris@0
|
49 return $this->data[$name];
|
Chris@0
|
50 }
|
Chris@0
|
51
|
Chris@0
|
52 $data = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')');
|
Chris@0
|
53
|
Chris@0
|
54 if (!$data) {
|
Chris@0
|
55 $data = null;
|
Chris@0
|
56 }
|
Chris@0
|
57
|
Chris@0
|
58 $this->data[$name] = $data;
|
Chris@0
|
59
|
Chris@0
|
60 return $data;
|
Chris@0
|
61 }
|
Chris@0
|
62
|
Chris@0
|
63 /**
|
Chris@0
|
64 * Register Atom Thread Extension 1.0 namespace
|
Chris@0
|
65 *
|
Chris@0
|
66 * @return void
|
Chris@0
|
67 */
|
Chris@0
|
68 protected function registerNamespaces()
|
Chris@0
|
69 {
|
Chris@0
|
70 $this->xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0');
|
Chris@0
|
71 }
|
Chris@0
|
72 }
|