File indexing completed on 2025-03-02 05:29:26

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage App
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_App_Extension
0026  */
0027 // require_once 'Zend/Gdata/App/Extension.php';
0028 
0029 /**
0030  * @see Zend_Gdata_App_Extension_Name
0031  */
0032 // require_once 'Zend/Gdata/App/Extension/Name.php';
0033 
0034 /**
0035  * @see Zend_Gdata_App_Extension_Email
0036  */
0037 // require_once 'Zend/Gdata/App/Extension/Email.php';
0038 
0039 /**
0040  * @see Zend_Gdata_App_Extension_Uri
0041  */
0042 // require_once 'Zend/Gdata/App/Extension/Uri.php';
0043 
0044 /**
0045  * Base class for people (currently used by atom:author, atom:contributor)
0046  *
0047  * @category   Zend
0048  * @package    Zend_Gdata
0049  * @subpackage App
0050  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0051  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0052  */
0053 abstract class Zend_Gdata_App_Extension_Person extends Zend_Gdata_App_Extension
0054 {
0055 
0056     protected $_rootElement = null;
0057     protected $_name = null;
0058     protected $_email = null;
0059     protected $_uri = null;
0060 
0061     public function __construct($name = null, $email = null, $uri = null)
0062     {
0063         parent::__construct();
0064         $this->_name = $name;
0065         $this->_email = $email;
0066         $this->_uri = $uri;
0067     }
0068 
0069     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0070     {
0071         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0072         if ($this->_name != null) {
0073             $element->appendChild($this->_name->getDOM($element->ownerDocument));
0074         }
0075         if ($this->_email != null) {
0076             $element->appendChild($this->_email->getDOM($element->ownerDocument));
0077         }
0078         if ($this->_uri != null) {
0079             $element->appendChild($this->_uri->getDOM($element->ownerDocument));
0080         }
0081         return $element;
0082     }
0083 
0084     protected function takeChildFromDOM($child)
0085     {
0086         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0087         switch ($absoluteNodeName) {
0088         case $this->lookupNamespace('atom') . ':' . 'name':
0089             $name = new Zend_Gdata_App_Extension_Name();
0090             $name->transferFromDOM($child);
0091             $this->_name = $name;
0092             break;
0093         case $this->lookupNamespace('atom') . ':' . 'email':
0094             $email = new Zend_Gdata_App_Extension_Email();
0095             $email->transferFromDOM($child);
0096             $this->_email = $email;
0097             break;
0098         case $this->lookupNamespace('atom') . ':' . 'uri':
0099             $uri = new Zend_Gdata_App_Extension_Uri();
0100             $uri->transferFromDOM($child);
0101             $this->_uri = $uri;
0102             break;
0103         default:
0104             parent::takeChildFromDOM($child);
0105             break;
0106         }
0107     }
0108 
0109     /**
0110      * @return Zend_Gdata_App_Extension_Name
0111      */
0112     public function getName()
0113     {
0114         return $this->_name;
0115     }
0116 
0117     /**
0118      * @param Zend_Gdata_App_Extension_Name $value
0119      * @return Zend_Gdata_App_Entry Provides a fluent interface
0120      */
0121     public function setName($value)
0122     {
0123         $this->_name = $value;
0124         return $this;
0125     }
0126 
0127     /**
0128      * @return Zend_Gdata_App_Extension_Email
0129      */
0130     public function getEmail()
0131     {
0132         return $this->_email;
0133     }
0134 
0135     /**
0136      * @param Zend_Gdata_App_Extension_Email $value
0137      * @return Zend_Gdata_App_Extension_Person Provides a fluent interface
0138      */
0139     public function setEmail($value)
0140     {
0141         $this->_email = $value;
0142         return $this;
0143     }
0144 
0145     /**
0146      * @return Zend_Gdata_App_Extension_Uri
0147      */
0148     public function getUri()
0149     {
0150         return $this->_uri;
0151     }
0152 
0153     /**
0154      * @param Zend_Gdata_App_Extension_Uri $value
0155      * @return Zend_Gdata_App_Extension_Person Provides a fluent interface
0156      */
0157     public function setUri($value)
0158     {
0159         $this->_uri = $value;
0160         return $this;
0161     }
0162 
0163 }