web/enmi/Zend/Service/Technorati/GetInfoResult.php
changeset 19 1c2f13fd785c
parent 0 4eba9c11703f
equal deleted inserted replaced
18:bd595ad770fc 19:1c2f13fd785c
       
     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-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id: GetInfoResult.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    21  */
       
    22 
       
    23 
       
    24 /**
       
    25  * Represents a single Technorati GetInfo query result object.
       
    26  *
       
    27  * @category   Zend
       
    28  * @package    Zend_Service
       
    29  * @subpackage Technorati
       
    30  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    31  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    32  */
       
    33 class Zend_Service_Technorati_GetInfoResult
       
    34 {
       
    35     /**
       
    36      * Technorati author
       
    37      *
       
    38      * @var     Zend_Service_Technorati_Author
       
    39      * @access  protected
       
    40      */
       
    41     protected $_author;
       
    42 
       
    43     /**
       
    44      * A list of weblogs claimed by this author
       
    45      *
       
    46      * @var     array
       
    47      * @access  protected
       
    48      */
       
    49     protected $_weblogs = array();
       
    50 
       
    51 
       
    52     /**
       
    53      * Constructs a new object object from DOM Document.
       
    54      *
       
    55      * @param   DomDocument $dom the ReST fragment for this object
       
    56      */
       
    57     public function __construct(DomDocument $dom)
       
    58     {
       
    59         $xpath = new DOMXPath($dom);
       
    60 
       
    61         /**
       
    62          * @see Zend_Service_Technorati_Author
       
    63          */
       
    64         require_once 'Zend/Service/Technorati/Author.php';
       
    65 
       
    66         $result = $xpath->query('//result');
       
    67         if ($result->length == 1) {
       
    68             $this->_author = new Zend_Service_Technorati_Author($result->item(0));
       
    69         }
       
    70 
       
    71         /**
       
    72          * @see Zend_Service_Technorati_Weblog
       
    73          */
       
    74         require_once 'Zend/Service/Technorati/Weblog.php';
       
    75 
       
    76         $result = $xpath->query('//item/weblog');
       
    77         if ($result->length >= 1) {
       
    78             foreach ($result as $weblog) {
       
    79                 $this->_weblogs[] = new Zend_Service_Technorati_Weblog($weblog);
       
    80             }
       
    81         }
       
    82     }
       
    83 
       
    84 
       
    85     /**
       
    86      * Returns the author associated with queried username.
       
    87      *
       
    88      * @return  Zend_Service_Technorati_Author
       
    89      */
       
    90     public function getAuthor() {
       
    91         return $this->_author;
       
    92     }
       
    93 
       
    94     /**
       
    95      * Returns the collection of weblogs authored by queried username.
       
    96      *
       
    97      * @return  array of Zend_Service_Technorati_Weblog
       
    98      */
       
    99     public function getWeblogs() {
       
   100         return $this->_weblogs;
       
   101     }
       
   102 
       
   103 }