File indexing completed on 2025-03-02 05:29:27
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 Gapps 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_Extension 0026 */ 0027 // require_once 'Zend/Gdata/Extension.php'; 0028 0029 /** 0030 * @see Zend_Gdata_Gapps 0031 */ 0032 // require_once 'Zend/Gdata/Gapps.php'; 0033 0034 /** 0035 * Represents the apps:emailList element used by the Apps data API. This 0036 * class represents properties of an email list and is usually contained 0037 * within an instance of Zend_Gdata_Gapps_EmailListEntry. 0038 * 0039 * @category Zend 0040 * @package Zend_Gdata 0041 * @subpackage Gapps 0042 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0043 * @license http://framework.zend.com/license/new-bsd New BSD License 0044 */ 0045 class Zend_Gdata_Gapps_Extension_EmailList extends Zend_Gdata_Extension 0046 { 0047 0048 protected $_rootNamespace = 'apps'; 0049 protected $_rootElement = 'emailList'; 0050 0051 /** 0052 * The name of the email list. This name is used as the email address 0053 * for this list. 0054 * 0055 * @var string 0056 */ 0057 protected $_name = null; 0058 0059 /** 0060 * Constructs a new Zend_Gdata_Gapps_Extension_EmailList object. 0061 * 0062 * @param string $name (optional) The name to be used for this email list. 0063 */ 0064 public function __construct($name = null) 0065 { 0066 $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); 0067 parent::__construct(); 0068 $this->_name = $name; 0069 } 0070 0071 /** 0072 * Retrieves a DOMElement which corresponds to this element and all 0073 * child properties. This is used to build an entry back into a DOM 0074 * and eventually XML text for sending to the server upon updates, or 0075 * for application storage/persistence. 0076 * 0077 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 0078 * @return DOMElement The DOMElement representing this element and all 0079 * child properties. 0080 */ 0081 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0082 { 0083 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0084 if ($this->_name !== null) { 0085 $element->setAttribute('name', $this->_name); 0086 } 0087 return $element; 0088 } 0089 0090 /** 0091 * Given a DOMNode representing an attribute, tries to map the data into 0092 * instance members. If no mapping is defined, the name and value are 0093 * stored in an array. 0094 * 0095 * @param DOMNode $attribute The DOMNode attribute needed to be handled 0096 */ 0097 protected function takeAttributeFromDOM($attribute) 0098 { 0099 switch ($attribute->localName) { 0100 case 'name': 0101 $this->_name = $attribute->nodeValue; 0102 break; 0103 default: 0104 parent::takeAttributeFromDOM($attribute); 0105 } 0106 } 0107 0108 /** 0109 * Get the value for this element's name attribute. 0110 * 0111 * @see setName 0112 * @return string The requested attribute. 0113 */ 0114 public function getName() 0115 { 0116 return $this->_name; 0117 } 0118 0119 /** 0120 * Set the value for this element's name attribute. This is the unique 0121 * name which will be used to identify this email list within this 0122 * domain, and will be used to form this email list's email address. 0123 * 0124 * @param string $value The desired value for this attribute. 0125 * @return Zend_Gdata_Gapps_Extension_EmailList The element being modified. 0126 */ 0127 public function setName($value) 0128 { 0129 $this->_name = $value; 0130 return $this; 0131 } 0132 0133 /** 0134 * Magic toString method allows using this directly via echo 0135 * Works best in PHP >= 4.2.0 0136 * 0137 * @return string 0138 */ 0139 public function __toString() 0140 { 0141 return $this->getName(); 0142 } 0143 0144 }