Merge file:///media/external_data/workspace/web/sport-group
[sport-group.git] / library / Zend / Service / Technorati / Author.php
blobbb7c089af32841b96d7f49b26035a4a0806f8a64
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
15 * @category Zend
16 * @package Zend_Service
17 * @subpackage Technorati
18 * @copyright Copyright (c) 2005-2009 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 16211 2009-06-21 19:23:55Z thomas $
24 /**
25 * @see Zend_Service_Technorati_Utils
27 require_once 'Zend/Service/Technorati/Utils.php';
30 /**
31 * Represents a weblog Author object. It usually belongs to a Technorati account.
33 * @category Zend
34 * @package Zend_Service
35 * @subpackage Technorati
36 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
37 * @license http://framework.zend.com/license/new-bsd New BSD License
39 class Zend_Service_Technorati_Author
41 /**
42 * Author first name
44 * @var string
45 * @access protected
47 protected $_firstName;
49 /**
50 * Author last name
52 * @var string
53 * @access protected
55 protected $_lastName;
57 /**
58 * Technorati account username
60 * @var string
61 * @access protected
63 protected $_username;
65 /**
66 * Technorati account description
68 * @var string
69 * @access protected
71 protected $_description;
73 /**
74 * Technorati account biography
76 * @var string
77 * @access protected
79 protected $_bio;
81 /**
82 * Technorati account thumbnail picture URL, if any
84 * @var null|Zend_Uri_Http
85 * @access protected
87 protected $_thumbnailPicture;
90 /**
91 * Constructs a new object from DOM Element.
93 * @param DomElement $dom the ReST fragment for this object
95 public function __construct(DomElement $dom)
97 $xpath = new DOMXPath($dom->ownerDocument);
99 $result = $xpath->query('./firstname/text()', $dom);
100 if ($result->length == 1) $this->setFirstName($result->item(0)->data);
102 $result = $xpath->query('./lastname/text()', $dom);
103 if ($result->length == 1) $this->setLastName($result->item(0)->data);
105 $result = $xpath->query('./username/text()', $dom);
106 if ($result->length == 1) $this->setUsername($result->item(0)->data);
108 $result = $xpath->query('./description/text()', $dom);
109 if ($result->length == 1) $this->setDescription($result->item(0)->data);
111 $result = $xpath->query('./bio/text()', $dom);
112 if ($result->length == 1) $this->setBio($result->item(0)->data);
114 $result = $xpath->query('./thumbnailpicture/text()', $dom);
115 if ($result->length == 1) $this->setThumbnailPicture($result->item(0)->data);
120 * Returns Author first name.
122 * @return string Author first name
124 public function getFirstName() {
125 return $this->_firstName;
129 * Returns Author last name.
131 * @return string Author last name
133 public function getLastName() {
134 return $this->_lastName;
138 * Returns Technorati account username.
140 * @return string Technorati account username
142 public function getUsername() {
143 return $this->_username;
147 * Returns Technorati account description.
149 * @return string Technorati account description
151 public function getDescription() {
152 return $this->_description;
156 * Returns Technorati account biography.
158 * @return string Technorati account biography
160 public function getBio() {
161 return $this->_bio;
165 * Returns Technorati account thumbnail picture.
167 * @return null|Zend_Uri_Http Technorati account thumbnail picture
169 public function getThumbnailPicture() {
170 return $this->_thumbnailPicture;
175 * Sets author first name.
177 * @param string $input first Name input value
178 * @return Zend_Service_Technorati_Author $this instance
180 public function setFirstName($input) {
181 $this->_firstName = (string) $input;
182 return $this;
186 * Sets author last name.
188 * @param string $input last Name input value
189 * @return Zend_Service_Technorati_Author $this instance
191 public function setLastName($input) {
192 $this->_lastName = (string) $input;
193 return $this;
197 * Sets Technorati account username.
199 * @param string $input username input value
200 * @return Zend_Service_Technorati_Author $this instance
202 public function setUsername($input) {
203 $this->_username = (string) $input;
204 return $this;
208 * Sets Technorati account biography.
210 * @param string $input biography input value
211 * @return Zend_Service_Technorati_Author $this instance
213 public function setBio($input) {
214 $this->_bio = (string) $input;
215 return $this;
219 * Sets Technorati account description.
221 * @param string $input description input value
222 * @return Zend_Service_Technorati_Author $this instance
224 public function setDescription($input) {
225 $this->_description = (string) $input;
226 return $this;
230 * Sets Technorati account thumbnail picture.
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)
237 public function setThumbnailPicture($input) {
238 $this->_thumbnailPicture = Zend_Service_Technorati_Utils::normalizeUriHttp($input);
239 return $this;