PageRenderTime 27ms CodeModel.GetById 24ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/zf/library/Zend/Service/Technorati/SearchResult.php

http://github.com/eryx/php-framework-benchmark
PHP | 150 lines | 36 code | 18 blank | 96 comment | 0 complexity | 2855b5d7d7dfbb7e37cb65671a3990eb MD5 | raw file
Possible License(s): MIT, BSD-3-Clause, Apache-2.0, LGPL-2.1, LGPL-3.0, BSD-2-Clause
  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-2011 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 23775 2011-03-01 17:25:24Z ralph $
 21 */
 22
 23
 24/**
 25 * @see Zend_Service_Technorati_Result
 26 */
 27require_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-2011 Zend Technologies USA Inc. (http://www.zend.com)
 39 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 40 */
 41class 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}