Merge file:///media/external_data/workspace/web/sport-group
[sport-group.git] / library / Zend / Service / Technorati / KeyInfoResult.php
blob34698cdce6abf26a959c90cff28063569f0ef8a2
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
15 * @category Zend
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 $
24 /**
25 * Represents a single Technorati KeyInfo query result object.
26 * It provides information about your Technorati API Key daily usage.
28 * @category Zend
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
36 /**
37 * Technorati API key
39 * @var string
40 * @access protected
42 protected $_apiKey;
44 /**
45 * Number of queries used today
47 * @var int
48 * @access protected
50 protected $_apiQueries;
52 /**
53 * Total number of available queries per day
55 * @var int
56 * @access protected
58 protected $_maxQueries;
61 /**
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);
80 /**
81 * Returns API Key string.
83 * @return string API Key string
85 public function getApiKey() {
86 return $this->_apiKey;
89 /**
90 * Returns the number of queries sent today.
92 * @return int number of queries sent today
94 public function getApiQueries() {
95 return $this->_apiQueries;
98 /**
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;
116 return $this;