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_Entry
0026  */
0027 // require_once 'Zend/Gdata/Entry.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Gapps_Extension_Login
0031  */
0032 // require_once 'Zend/Gdata/Gapps/Extension/Login.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Gapps_Extension_Nickname
0036  */
0037 // require_once 'Zend/Gdata/Gapps/Extension/Nickname.php';
0038 
0039 /**
0040  * Data model class for a Google Apps Nickname Entry.
0041  *
0042  * Each nickname entry describes a single nickname within a Google Apps
0043  * hosted domain. Each user may own several nicknames, but each nickname may
0044  * only belong to one user. Multiple entries are contained within instances
0045  * of Zend_Gdata_Gapps_NicknameFeed.
0046  *
0047  * To transfer nickname entries to and from the Google Apps servers,
0048  * including creating new entries, refer to the Google Apps service class,
0049  * Zend_Gdata_Gapps.
0050  *
0051  * This class represents <atom:entry> in the Google Data protocol.
0052  *
0053  * @category   Zend
0054  * @package    Zend_Gdata
0055  * @subpackage Gapps
0056  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0057  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0058  */
0059 class Zend_Gdata_Gapps_NicknameEntry extends Zend_Gdata_Entry
0060 {
0061 
0062     protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry';
0063 
0064     /**
0065      * <apps:login> element used to hold information about the owner
0066      * of this nickname, including their username.
0067      *
0068      * @var Zend_Gdata_Gapps_Extension_Login
0069      */
0070     protected $_login = null;
0071 
0072     /**
0073      * <apps:nickname> element used to hold the name of this nickname.
0074      *
0075      * @var Zend_Gdata_Gapps_Extension_Nickname
0076      */
0077     protected $_nickname = null;
0078 
0079     /**
0080      * Create a new instance.
0081      *
0082      * @param DOMElement $element (optional) DOMElement from which this
0083      *          object should be constructed.
0084      */
0085     public function __construct($element = null)
0086     {
0087         $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
0088         parent::__construct($element);
0089     }
0090 
0091     /**
0092      * Retrieves a DOMElement which corresponds to this element and all
0093      * child properties.  This is used to build an entry back into a DOM
0094      * and eventually XML text for application storage/persistence.
0095      *
0096      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0097      * @return DOMElement The DOMElement representing this element and all
0098      *          child properties.
0099      */
0100     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0101     {
0102         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0103         if ($this->_login !== null) {
0104             $element->appendChild($this->_login->getDOM($element->ownerDocument));
0105         }
0106         if ($this->_nickname !== null) {
0107             $element->appendChild($this->_nickname->getDOM($element->ownerDocument));
0108         }
0109         return $element;
0110     }
0111 
0112     /**
0113      * Creates individual Entry objects of the appropriate type and
0114      * stores them as members of this entry based upon DOM data.
0115      *
0116      * @param DOMNode $child The DOMNode to process
0117      */
0118     protected function takeChildFromDOM($child)
0119     {
0120         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0121 
0122         switch ($absoluteNodeName) {
0123             case $this->lookupNamespace('apps') . ':' . 'login';
0124                 $login = new Zend_Gdata_Gapps_Extension_Login();
0125                 $login->transferFromDOM($child);
0126                 $this->_login = $login;
0127                 break;
0128             case $this->lookupNamespace('apps') . ':' . 'nickname';
0129                 $nickname = new Zend_Gdata_Gapps_Extension_Nickname();
0130                 $nickname->transferFromDOM($child);
0131                 $this->_nickname = $nickname;
0132                 break;
0133             default:
0134                 parent::takeChildFromDOM($child);
0135                 break;
0136         }
0137     }
0138 
0139     /**
0140      * Get the value of the login property for this object.
0141      *
0142      * @see setLogin
0143      * @return Zend_Gdata_Gapps_Extension_Login The requested object.
0144      */
0145     public function getLogin()
0146     {
0147         return $this->_login;
0148     }
0149 
0150     /**
0151      * Set the value of the login property for this object. This property
0152      * is used to store the username address of the current user.
0153      *
0154      * @param Zend_Gdata_Gapps_Extension_Login $value The desired value for
0155      *          this instance's login property.
0156      * @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface.
0157      */
0158     public function setLogin($value)
0159     {
0160         $this->_login = $value;
0161         return $this;
0162     }
0163 
0164     /**
0165      * Get the value of the nickname property for this object.
0166      *
0167      * @see setNickname
0168      * @return Zend_Gdata_Gapps_Extension_Nickname The requested object.
0169      */
0170     public function getNickname()
0171     {
0172         return $this->_nickname;
0173     }
0174 
0175     /**
0176      * Set the value of the nickname property for this object. This property
0177      * is used to store the the name of the current nickname.
0178      *
0179      * @param Zend_Gdata_Gapps_Extension_Nickname $value The desired value for
0180      *          this instance's nickname property.
0181      * @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface.
0182      */
0183     public function setNickname($value)
0184     {
0185         $this->_nickname = $value;
0186         return $this;
0187     }
0188 
0189 }