~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Service/Technorati/TagResultSet.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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_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 $
 
21
 */
 
22
 
 
23
 
 
24
/** 
 
25
 * @see Zend_Service_Technorati_ResultSet 
 
26
 */
 
27
require_once 'Zend/Service/Technorati/ResultSet.php';
 
28
 
 
29
 
 
30
/**
 
31
 * Represents a Technorati Tag query result set.
 
32
 * 
 
33
 * @category   Zend
 
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
 
38
 */
 
39
class Zend_Service_Technorati_TagResultSet extends Zend_Service_Technorati_ResultSet
 
40
{
 
41
    /**
 
42
     * Number of posts that match the tag.
 
43
     *
 
44
     * @var     int
 
45
     * @access  protected
 
46
     */
 
47
    protected $_postsMatched;
 
48
 
 
49
    /**
 
50
     * Number of blogs that match the tag.
 
51
     *
 
52
     * @var     int
 
53
     * @access  protected
 
54
     */
 
55
    protected $_blogsMatched;
 
56
 
 
57
    /**
 
58
     * Parses the search response and retrieve the results for iteration.
 
59
     *
 
60
     * @param   DomDocument $dom    the ReST fragment for this object
 
61
     * @param   array $options      query options as associative array
 
62
     */
 
63
    public function __construct(DomDocument $dom, $options = array())
 
64
    {
 
65
        parent::__construct($dom, $options);
 
66
 
 
67
        $result = $this->_xpath->query('/tapi/document/result/postsmatched/text()');
 
68
        if ($result->length == 1) $this->_postsMatched = (int) $result->item(0)->data;
 
69
 
 
70
        $result = $this->_xpath->query('/tapi/document/result/blogsmatched/text()');
 
71
        if ($result->length == 1) $this->_blogsMatched = (int) $result->item(0)->data;
 
72
 
 
73
        $this->_totalResultsReturned  = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
 
74
        /** @todo Validate the following assertion */
 
75
        $this->_totalResultsAvailable = (int) $this->getPostsMatched();
 
76
    }
 
77
 
 
78
 
 
79
    /**
 
80
     * Returns the number of posts that match the tag.
 
81
     * 
 
82
     * @return  int
 
83
     */
 
84
    public function getPostsMatched() {
 
85
        return $this->_postsMatched;
 
86
    }
 
87
 
 
88
    /**
 
89
     * Returns the number of blogs that match the tag.
 
90
     * 
 
91
     * @return  int
 
92
     */
 
93
    public function getBlogsMatched() {
 
94
        return $this->_blogsMatched;
 
95
    }
 
96
 
 
97
    /**
 
98
     * Implements Zend_Service_Technorati_ResultSet::current().
 
99
     *
 
100
     * @return Zend_Service_Technorati_TagResult current result
 
101
     */
 
102
    public function current()
 
103
    {
 
104
        /**
 
105
         * @see Zend_Service_Technorati_TagResult
 
106
         */
 
107
        require_once 'Zend/Service/Technorati/TagResult.php';
 
108
        return new Zend_Service_Technorati_TagResult($this->_results->item($this->_currentIndex));
 
109
    }
 
110
}