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-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: KeyInfoResult.php 16211 2009-06-21 19:23:55Z thomas $
25 * Represents a single Technorati KeyInfo query result object.
26 * It provides information about your Technorati API Key daily usage.
29 * @package Zend_Service
30 * @subpackage Technorati
31 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
32 * @license http://framework.zend.com/license/new-bsd New BSD License
34 class Zend_Service_Technorati_KeyInfoResult
45 * Number of queries used today
50 protected $_apiQueries;
53 * Total number of available queries per day
58 protected $_maxQueries;
62 * Constructs a new object from DOM Element.
63 * Parses given Key element from $dom and sets API key string.
65 * @param DomElement $dom the ReST fragment for this object
66 * @param string $apiKey the API Key string
68 public function __construct(DomDocument
$dom, $apiKey = null)
70 // $this->_dom = $dom;
71 // $this->_xpath = new DOMXPath($dom);
72 $xpath = new DOMXPath($dom);
74 $this->_apiQueries
= (int) $xpath->query('/tapi/document/result/apiqueries/text()')->item(0)->data
;
75 $this->_maxQueries
= (int) $xpath->query('/tapi/document/result/maxqueries/text()')->item(0)->data
;
76 $this->setApiKey($apiKey);
81 * Returns API Key string.
83 * @return string API Key string
85 public function getApiKey() {
86 return $this->_apiKey
;
90 * Returns the number of queries sent today.
92 * @return int number of queries sent today
94 public function getApiQueries() {
95 return $this->_apiQueries
;
99 * Returns Key's daily query limit.
101 * @return int maximum number of available queries per day
103 public function getMaxQueries() {
104 return $this->_maxQueries
;
109 * Sets API Key string.
111 * @param string $apiKey the API Key
112 * @return Zend_Service_Technorati_KeyInfoResult $this instance
114 public function setApiKey($apiKey) {
115 $this->_apiKey
= $apiKey;