[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Gdata/Extension/ -> ExtendedProperty.php (source)

   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 [email protected] so we can send you a copy immediately.
  15   *
  16   * @category   Zend
  17   * @package    Zend_Gdata
  18   * @subpackage Gdata
  19   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  20   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  21   * @version    $Id$
  22   */
  23  
  24  /**
  25   * @see Zend_Gdata_Extension
  26   */
  27  require_once 'Zend/Gdata/Extension.php';
  28  
  29  /**
  30   * Data model for gd:extendedProperty element, used by some Gdata
  31   * services to implement arbitrary name/value pair storage
  32   *
  33   * @category   Zend
  34   * @package    Zend_Gdata
  35   * @subpackage Gdata
  36   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  37   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  38   */
  39  class Zend_Gdata_Extension_ExtendedProperty extends Zend_Gdata_Extension
  40  {
  41  
  42      protected $_rootElement = 'extendedProperty';
  43      protected $_name = null;
  44      protected $_value = null;
  45  
  46      public function __construct($name = null, $value = null)
  47      {
  48          parent::__construct();
  49          $this->_name = $name;
  50          $this->_value = $value;
  51      }
  52  
  53      public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  54      {
  55          $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  56          if ($this->_name !== null) {
  57              $element->setAttribute('name', $this->_name);
  58          }
  59          if ($this->_value !== null) {
  60              $element->setAttribute('value', $this->_value);
  61          }
  62          return $element;
  63      }
  64  
  65      protected function takeAttributeFromDOM($attribute)
  66      {
  67          switch ($attribute->localName) {
  68          case 'name':
  69              $this->_name = $attribute->nodeValue;
  70              break;
  71          case 'value':
  72              $this->_value = $attribute->nodeValue;
  73              break;
  74          default:
  75              parent::takeAttributeFromDOM($attribute);
  76          }
  77      }
  78  
  79      public function __toString()
  80      {
  81          return $this->getName() . '=' . $this->getValue();
  82      }
  83  
  84      public function getName()
  85      {
  86          return $this->_name;
  87      }
  88  
  89      public function setName($value)
  90      {
  91          $this->_name = $value;
  92          return $this;
  93      }
  94  
  95      public function getValue()
  96      {
  97          return $this->_value;
  98      }
  99  
 100      public function setValue($value)
 101      {
 102          $this->_value = $value;
 103          return $this;
 104      }
 105  
 106  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1