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.
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 $
25 * @see Zend_Service_Technorati_Utils
27 require_once 'Zend/Service/Technorati/Utils.php';
31 * Represents a weblog Author object. It usually belongs to a Technorati account.
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
47 protected $_firstName;
58 * Technorati account username
66 * Technorati account description
71 protected $_description;
74 * Technorati account biography
82 * Technorati account thumbnail picture URL, if any
84 * @var null|Zend_Uri_Http
87 protected $_thumbnailPicture;
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() {
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;
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;
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;
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;
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;
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);