8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: Person.php 16971 2009-07-22 18:05:45Z mikaelkael $
25 * @see Zend_Gdata_App_Extension
27 require_once 'Zend/Gdata/App/Extension.php';
30 * @see Zend_Gdata_App_Extension_Name
32 require_once 'Zend/Gdata/App/Extension/Name.php';
35 * @see Zend_Gdata_App_Extension_Email
37 require_once 'Zend/Gdata/App/Extension/Email.php';
40 * @see Zend_Gdata_App_Extension_Uri
42 require_once 'Zend/Gdata/App/Extension/Uri.php';
45 * Base class for people (currently used by atom:author, atom:contributor)
50 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
51 * @license http://framework.zend.com/license/new-bsd New BSD License
53 abstract class Zend_Gdata_App_Extension_Person
extends Zend_Gdata_App_Extension
56 protected $_rootElement = null;
57 protected $_name = null;
58 protected $_email = null;
59 protected $_uri = null;
61 public function __construct($name = null, $email = null, $uri = null)
63 parent
::__construct();
65 $this->_email
= $email;
69 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
71 $element = parent
::getDOM($doc, $majorVersion, $minorVersion);
72 if ($this->_name
!= null) {
73 $element->appendChild($this->_name
->getDOM($element->ownerDocument
));
75 if ($this->_email
!= null) {
76 $element->appendChild($this->_email
->getDOM($element->ownerDocument
));
78 if ($this->_uri
!= null) {
79 $element->appendChild($this->_uri
->getDOM($element->ownerDocument
));
84 protected function takeChildFromDOM($child)
86 $absoluteNodeName = $child->namespaceURI
. ':' . $child->localName
;
87 switch ($absoluteNodeName) {
88 case $this->lookupNamespace('atom') . ':' . 'name':
89 $name = new Zend_Gdata_App_Extension_Name();
90 $name->transferFromDOM($child);
93 case $this->lookupNamespace('atom') . ':' . 'email':
94 $email = new Zend_Gdata_App_Extension_Email();
95 $email->transferFromDOM($child);
96 $this->_email
= $email;
98 case $this->lookupNamespace('atom') . ':' . 'uri':
99 $uri = new Zend_Gdata_App_Extension_Uri();
100 $uri->transferFromDOM($child);
104 parent
::takeChildFromDOM($child);
110 * @return Zend_Gdata_App_Extension_Name
112 public function getName()
118 * @param Zend_Gdata_App_Extension_Name $value
119 * @return Zend_Gdata_App_Entry Provides a fluent interface
121 public function setName($value)
123 $this->_name
= $value;
128 * @return Zend_Gdata_App_Extension_Email
130 public function getEmail()
132 return $this->_email
;
136 * @param Zend_Gdata_App_Extension_Email $value
137 * @return Zend_Gdata_App_Extension_Person Provides a fluent interface
139 public function setEmail($value)
141 $this->_email
= $value;
146 * @return Zend_Gdata_App_Extension_Uri
148 public function getUri()
154 * @param Zend_Gdata_App_Extension_Uri $value
155 * @return Zend_Gdata_App_Extension_Person Provides a fluent interface
157 public function setUri($value)
159 $this->_uri
= $value;