PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/eryx/php-framework-benchmark
PHP | 242 lines | 69 code | 32 blank | 141 comment | 12 complexity | babcb0d87706c727abf44c8ac2d5ff4a 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: Author.php 23775 2011-03-01 17:25:24Z ralph $
 21 */
 22
 23
 24/**
 25 * @see Zend_Service_Technorati_Utils
 26 */
 27require_once 'Zend/Service/Technorati/Utils.php';
 28
 29
 30/**
 31 * Represents a weblog Author object. It usually belongs to a Technorati account.
 32 *
 33 * @category   Zend
 34 * @package    Zend_Service
 35 * @subpackage Technorati
 36 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 37 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 38 */
 39class Zend_Service_Technorati_Author
 40{
 41    /**
 42     * Author first name
 43     *
 44     * @var     string
 45     * @access  protected
 46     */
 47    protected $_firstName;
 48
 49    /**
 50     * Author last name
 51     *
 52     * @var     string
 53     * @access  protected
 54     */
 55    protected $_lastName;
 56
 57    /**
 58     * Technorati account username
 59     *
 60     * @var     string
 61     * @access  protected
 62     */
 63    protected $_username;
 64
 65    /**
 66     * Technorati account description
 67     *
 68     * @var     string
 69     * @access  protected
 70     */
 71    protected $_description;
 72
 73    /**
 74     * Technorati account biography
 75     *
 76     * @var     string
 77     * @access  protected
 78     */
 79    protected $_bio;
 80
 81    /**
 82     * Technorati account thumbnail picture URL, if any
 83     *
 84     * @var     null|Zend_Uri_Http
 85     * @access  protected
 86     */
 87    protected $_thumbnailPicture;
 88
 89
 90    /**
 91     * Constructs a new object from DOM Element.
 92     *
 93     * @param   DomElement $dom the ReST fragment for this object
 94     */
 95    public function __construct(DomElement $dom)
 96    {
 97        $xpath = new DOMXPath($dom->ownerDocument);
 98
 99        $result = $xpath->query('./firstname/text()', $dom);
100        if ($result->length == 1) $this->setFirstName($result->item(0)->data);
101
102        $result = $xpath->query('./lastname/text()', $dom);
103        if ($result->length == 1) $this->setLastName($result->item(0)->data);
104
105        $result = $xpath->query('./username/text()', $dom);
106        if ($result->length == 1) $this->setUsername($result->item(0)->data);
107
108        $result = $xpath->query('./description/text()', $dom);
109        if ($result->length == 1) $this->setDescription($result->item(0)->data);
110
111        $result = $xpath->query('./bio/text()', $dom);
112        if ($result->length == 1) $this->setBio($result->item(0)->data);
113
114        $result = $xpath->query('./thumbnailpicture/text()', $dom);
115        if ($result->length == 1) $this->setThumbnailPicture($result->item(0)->data);
116    }
117
118
119    /**
120     * Returns Author first name.
121     *
122     * @return  string  Author first name
123     */
124    public function getFirstName() {
125        return $this->_firstName;
126    }
127
128    /**
129     * Returns Author last name.
130     *
131     * @return  string  Author last name
132     */
133    public function getLastName() {
134        return $this->_lastName;
135    }
136
137    /**
138     * Returns Technorati account username.
139     *
140     * @return  string  Technorati account username
141     */
142    public function getUsername() {
143        return $this->_username;
144    }
145
146    /**
147     * Returns Technorati account description.
148     *
149     * @return  string  Technorati account description
150     */
151    public function getDescription() {
152        return $this->_description;
153    }
154
155    /**
156     * Returns Technorati account biography.
157     *
158     * @return  string  Technorati account biography
159     */
160    public function getBio() {
161        return $this->_bio;
162    }
163
164    /**
165     * Returns Technorati account thumbnail picture.
166     *
167     * @return  null|Zend_Uri_Http  Technorati account thumbnail picture
168     */
169    public function getThumbnailPicture() {
170        return $this->_thumbnailPicture;
171    }
172
173
174    /**
175     * Sets author first name.
176     *
177     * @param   string $input   first Name input value
178     * @return  Zend_Service_Technorati_Author  $this instance
179     */
180    public function setFirstName($input) {
181        $this->_firstName = (string) $input;
182        return $this;
183    }
184
185    /**
186     * Sets author last name.
187     *
188     * @param   string $input   last Name input value
189     * @return  Zend_Service_Technorati_Author  $this instance
190     */
191    public function setLastName($input) {
192        $this->_lastName = (string) $input;
193        return $this;
194    }
195
196    /**
197     * Sets Technorati account username.
198     *
199     * @param   string $input   username input value
200     * @return  Zend_Service_Technorati_Author  $this instance
201     */
202    public function setUsername($input) {
203        $this->_username = (string) $input;
204        return $this;
205    }
206
207    /**
208     * Sets Technorati account biography.
209     *
210     * @param   string $input   biography input value
211     * @return  Zend_Service_Technorati_Author  $this instance
212     */
213    public function setBio($input) {
214        $this->_bio = (string) $input;
215        return $this;
216    }
217
218    /**
219     * Sets Technorati account description.
220     *
221     * @param   string $input   description input value
222     * @return  Zend_Service_Technorati_Author  $this instance
223     */
224    public function setDescription($input) {
225        $this->_description = (string) $input;
226        return $this;
227    }
228
229    /**
230     * Sets Technorati account thumbnail picture.
231     *
232     * @param   string|Zend_Uri_Http $input thumbnail picture URI
233     * @return  Zend_Service_Technorati_Author  $this instance
234     * @throws  Zend_Service_Technorati_Exception if $input is an invalid URI
235     *          (via Zend_Service_Technorati_Utils::normalizeUriHttp)
236     */
237    public function setThumbnailPicture($input) {
238        $this->_thumbnailPicture = Zend_Service_Technorati_Utils::normalizeUriHttp($input);
239        return $this;
240    }
241
242}