PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/zf/library/Zend/Gdata/Gapps/EmailListRecipientEntry.php

http://github.com/eryx/php-framework-benchmark
PHP | 146 lines | 44 code | 13 blank | 89 comment | 2 complexity | 05854045742aa1fe5f3fc0b7bceab0f6 MD5 | raw file
Possible License(s): MIT, BSD-3-Clause, Apache-2.0, LGPL-2.1, LGPL-3.0, BSD-2-Clause
  1<?php
  2
  3/**
  4 * Zend Framework
  5 *
  6 * LICENSE
  7 *
  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.
 15 *
 16 * @category   Zend
 17 * @package    Zend_Gdata
 18 * @subpackage Gapps
 19 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 21 * @version    $Id: EmailListRecipientEntry.php 23775 2011-03-01 17:25:24Z ralph $
 22 */
 23
 24/**
 25 * @see Zend_Gdata_Entry
 26 */
 27require_once 'Zend/Gdata/Entry.php';
 28
 29/**
 30 * @see Zend_Gdata_Extension_Who
 31 */
 32require_once 'Zend/Gdata/Extension/Who.php';
 33
 34/**
 35 * Data model class for a Google Apps Email List Recipient Entry.
 36 *
 37 * Each instance of this class represents a recipient of an email list
 38 * hosted on a Google Apps domain. Each email list may contain multiple
 39 * recipients. Email lists themselves are described by
 40 * Zend_Gdata_EmailListEntry. Multiple recipient entries are contained within
 41 * instances of Zend_Gdata_Gapps_EmailListRecipientFeed.
 42 *
 43 * To transfer email list recipients to and from the Google Apps servers,
 44 * including creating new recipients, refer to the Google Apps service class,
 45 * Zend_Gdata_Gapps.
 46 *
 47 * This class represents <atom:entry> in the Google Data protocol.
 48 *
 49 * @category   Zend
 50 * @package    Zend_Gdata
 51 * @subpackage Gapps
 52 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 53 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 54 */
 55class Zend_Gdata_Gapps_EmailListRecipientEntry extends Zend_Gdata_Entry
 56{
 57
 58    protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListRecipientEntry';
 59
 60    /**
 61     * <gd:who> element used to store the email address of the current
 62     * recipient. Only the email property of this element should be
 63     * populated.
 64     *
 65     * @var Zend_Gdata_Extension_Who
 66     */
 67    protected $_who = null;
 68
 69    /**
 70     * Create a new instance.
 71     *
 72     * @param DOMElement $element (optional) DOMElement from which this
 73     *          object should be constructed.
 74     */
 75    public function __construct($element = null)
 76    {
 77        $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
 78        parent::__construct($element);
 79    }
 80
 81    /**
 82     * Retrieves a DOMElement which corresponds to this element and all
 83     * child properties.  This is used to build an entry back into a DOM
 84     * and eventually XML text for application storage/persistence.
 85     *
 86     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
 87     * @return DOMElement The DOMElement representing this element and all
 88     *          child properties.
 89     */
 90    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 91    {
 92        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
 93        if ($this->_who !== null) {
 94            $element->appendChild($this->_who->getDOM($element->ownerDocument));
 95        }
 96        return $element;
 97    }
 98
 99    /**
100     * Creates individual Entry objects of the appropriate type and
101     * stores them as members of this entry based upon DOM data.
102     *
103     * @param DOMNode $child The DOMNode to process
104     */
105    protected function takeChildFromDOM($child)
106    {
107        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
108
109        switch ($absoluteNodeName) {
110            case $this->lookupNamespace('gd') . ':' . 'who';
111                $who = new Zend_Gdata_Extension_Who();
112                $who->transferFromDOM($child);
113                $this->_who = $who;
114                break;
115            default:
116                parent::takeChildFromDOM($child);
117                break;
118        }
119    }
120
121    /**
122     * Get the value of the who property for this object.
123     *
124     * @see setWho
125     * @return Zend_Gdata_Extension_Who The requested object.
126     */
127    public function getWho()
128    {
129        return $this->_who;
130    }
131
132    /**
133     * Set the value of the who property for this object. This property
134     * is used to store the email address of the current recipient.
135     *
136     * @param Zend_Gdata_Extension_Who $value The desired value for this
137     *          instance's who property.
138     * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface.
139     */
140    public function setWho($value)
141    {
142        $this->_who = $value;
143        return $this;
144    }
145
146}