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.
16
* @package Zend_Service
17
* @subpackage Technorati
18
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
* @license http://framework.zend.com/license/new-bsd New BSD License
20
* @version $Id: TagResultSet.php 8064 2008-02-16 10:58:39Z thomas $
25
* @see Zend_Service_Technorati_ResultSet
27
require_once 'Zend/Service/Technorati/ResultSet.php';
31
* Represents a Technorati Tag query result set.
34
* @package Zend_Service
35
* @subpackage Technorati
36
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
37
* @license http://framework.zend.com/license/new-bsd New BSD License
39
class Zend_Service_Technorati_TagResultSet extends Zend_Service_Technorati_ResultSet
42
* Number of posts that match the tag.
47
protected $_postsMatched;
50
* Number of blogs that match the tag.
55
protected $_blogsMatched;
58
* Parses the search response and retrieve the results for iteration.
60
* @param DomDocument $dom the ReST fragment for this object
61
* @param array $options query options as associative array
63
public function __construct(DomDocument $dom, $options = array())
65
parent::__construct($dom, $options);
67
$result = $this->_xpath->query('/tapi/document/result/postsmatched/text()');
68
if ($result->length == 1) $this->_postsMatched = (int) $result->item(0)->data;
70
$result = $this->_xpath->query('/tapi/document/result/blogsmatched/text()');
71
if ($result->length == 1) $this->_blogsMatched = (int) $result->item(0)->data;
73
$this->_totalResultsReturned = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
74
/** @todo Validate the following assertion */
75
$this->_totalResultsAvailable = (int) $this->getPostsMatched();
80
* Returns the number of posts that match the tag.
84
public function getPostsMatched() {
85
return $this->_postsMatched;
89
* Returns the number of blogs that match the tag.
93
public function getBlogsMatched() {
94
return $this->_blogsMatched;
98
* Implements Zend_Service_Technorati_ResultSet::current().
100
* @return Zend_Service_Technorati_TagResult current result
102
public function current()
105
* @see Zend_Service_Technorati_TagResult
107
require_once 'Zend/Service/Technorati/TagResult.php';
108
return new Zend_Service_Technorati_TagResult($this->_results->item($this->_currentIndex));