~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Service/Technorati/KeyInfoResult.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: KeyInfoResult.php 8064 2008-02-16 10:58:39Z thomas $
 
21
 */
 
22
 
 
23
 
 
24
/**
 
25
 * Represents a single Technorati KeyInfo query result object.
 
26
 * It provides information about your Technorati API Key daily usage.
 
27
 * 
 
28
 * @category   Zend
 
29
 * @package    Zend_Service
 
30
 * @subpackage Technorati
 
31
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
32
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
33
 */
 
34
class Zend_Service_Technorati_KeyInfoResult
 
35
{
 
36
    /**
 
37
     * Technorati API key
 
38
     *
 
39
     * @var     string
 
40
     * @access  protected
 
41
     */
 
42
    protected $_apiKey;
 
43
 
 
44
    /**
 
45
     * Number of queries used today
 
46
     *
 
47
     * @var     int
 
48
     * @access  protected
 
49
     */
 
50
    protected $_apiQueries;
 
51
 
 
52
    /**
 
53
     * Total number of available queries per day
 
54
     *
 
55
     * @var     int
 
56
     * @access  protected
 
57
     */
 
58
    protected $_maxQueries;
 
59
    
 
60
 
 
61
    /**
 
62
     * Constructs a new object from DOM Element.
 
63
     * Parses given Key element from $dom and sets API key string.
 
64
     *
 
65
     * @param   DomElement $dom the ReST fragment for this object
 
66
     * @param   string $apiKey  the API Key string
 
67
     */
 
68
    public function __construct(DomDocument $dom, $apiKey = null)
 
69
    {
 
70
        // $this->_dom   = $dom;
 
71
        // $this->_xpath = new DOMXPath($dom);
 
72
        $xpath = new DOMXPath($dom);
 
73
 
 
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);
 
77
    }
 
78
    
 
79
    
 
80
    /**
 
81
     * Returns API Key string.
 
82
     * 
 
83
     * @return  string  API Key string
 
84
     */
 
85
    public function getApiKey() {
 
86
        return $this->_apiKey;
 
87
    }
 
88
    
 
89
    /**
 
90
     * Returns the number of queries sent today.
 
91
     * 
 
92
     * @return  int     number of queries sent today
 
93
     */
 
94
    public function getApiQueries() {
 
95
        return $this->_apiQueries;
 
96
    }
 
97
    
 
98
    /**
 
99
     * Returns Key's daily query limit.
 
100
     * 
 
101
     * @return  int     maximum number of available queries per day
 
102
     */
 
103
    public function getMaxQueries() {
 
104
        return $this->_maxQueries;
 
105
    }
 
106
    
 
107
    
 
108
    /**
 
109
     * Sets API Key string.
 
110
     * 
 
111
     * @param   string $apiKey  the API Key
 
112
     * @return  Zend_Service_Technorati_KeyInfoResult $this instance
 
113
     */
 
114
    public function setApiKey($apiKey) {
 
115
        $this->_apiKey = $apiKey;
 
116
        return $this;
 
117
    }
 
118
}