web/lib/Zend/Service/Technorati/SearchResult.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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: SearchResult.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    21  */
       
    22 
       
    23 
       
    24 /**
       
    25  * @see Zend_Service_Technorati_Result
       
    26  */
       
    27 require_once 'Zend/Service/Technorati/Result.php';
       
    28 
       
    29 
       
    30 /**
       
    31  * Represents a single Technorati Search query result object.
       
    32  * It is never returned as a standalone object,
       
    33  * but it always belongs to a valid Zend_Service_Technorati_SearchResultSet object.
       
    34  *
       
    35  * @category   Zend
       
    36  * @package    Zend_Service
       
    37  * @subpackage Technorati
       
    38  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    39  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    40  */
       
    41 class Zend_Service_Technorati_SearchResult extends Zend_Service_Technorati_Result
       
    42 {
       
    43     /**
       
    44      * Technorati weblog object corresponding to queried keyword.
       
    45      *
       
    46      * @var     Zend_Service_Technorati_Weblog
       
    47      * @access  protected
       
    48      */
       
    49     protected $_weblog;
       
    50 
       
    51     /**
       
    52      * The title of the entry.
       
    53      *
       
    54      * @var     string
       
    55      * @access  protected
       
    56      */
       
    57     protected $_title;
       
    58 
       
    59     /**
       
    60      * The blurb from entry with search term highlighted.
       
    61      *
       
    62      * @var     string
       
    63      * @access  protected
       
    64      */
       
    65     protected $_excerpt;
       
    66 
       
    67     /**
       
    68      * The datetime the entry was created.
       
    69      *
       
    70      * @var     Zend_Date
       
    71      * @access  protected
       
    72      */
       
    73     protected $_created;
       
    74 
       
    75     /**
       
    76      * The permalink of the blog entry.
       
    77      *
       
    78      * @var     Zend_Uri_Http
       
    79      * @access  protected
       
    80      */
       
    81     protected $_permalink;
       
    82 
       
    83 
       
    84     /**
       
    85      * Constructs a new object object from DOM Element.
       
    86      *
       
    87      * @param   DomElement $dom the ReST fragment for this object
       
    88      */
       
    89     public function __construct(DomElement $dom)
       
    90     {
       
    91         $this->_fields = array( '_permalink'    => 'permalink',
       
    92                                 '_excerpt'      => 'excerpt',
       
    93                                 '_created'      => 'created',
       
    94                                 '_title'        => 'title');
       
    95         parent::__construct($dom);
       
    96 
       
    97         // weblog object field
       
    98         $this->_parseWeblog();
       
    99 
       
   100         // filter fields
       
   101         $this->_permalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_permalink);
       
   102         $this->_created = Zend_Service_Technorati_Utils::normalizeDate($this->_created);
       
   103     }
       
   104 
       
   105     /**
       
   106      * Returns the weblog object that links queried URL.
       
   107      *
       
   108      * @return  Zend_Service_Technorati_Weblog
       
   109      */
       
   110     public function getWeblog() {
       
   111         return $this->_weblog;
       
   112     }
       
   113 
       
   114     /**
       
   115      * Returns the title of the entry.
       
   116      *
       
   117      * @return  string
       
   118      */
       
   119     public function getTitle() {
       
   120         return $this->_title;
       
   121     }
       
   122 
       
   123     /**
       
   124      * Returns the blurb from entry with search term highlighted.
       
   125      *
       
   126      * @return  string
       
   127      */
       
   128     public function getExcerpt() {
       
   129         return $this->_excerpt;
       
   130     }
       
   131 
       
   132     /**
       
   133      * Returns the datetime the entry was created.
       
   134      *
       
   135      * @return  Zend_Date
       
   136      */
       
   137     public function getCreated() {
       
   138         return $this->_created;
       
   139     }
       
   140 
       
   141     /**
       
   142      * Returns the permalink of the blog entry.
       
   143      *
       
   144      * @return  Zend_Uri_Http
       
   145      */
       
   146     public function getPermalink() {
       
   147         return $this->_permalink;
       
   148     }
       
   149 
       
   150 }