[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Amf/Value/ -> TraitsInfo.php (source)

   1  <?php
   2  /**
   3   * Zend Framework
   4   *
   5   * LICENSE
   6   *
   7   * This source file is subject to the new BSD license that is bundled
   8   * with this package in the file LICENSE.txt.
   9   * It is also available through the world-wide-web at this URL:
  10   * http://framework.zend.com/license/new-bsd
  11   * If you did not receive a copy of the license and are unable to
  12   * obtain it through the world-wide-web, please send an email
  13   * to [email protected] so we can send you a copy immediately.
  14   *
  15   * @category   Zend
  16   * @package    Zend_Amf
  17   * @subpackage Value
  18   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  20   * @version    $Id$
  21   */
  22  
  23  /**
  24   * Zend_Amf_Value_TraitsInfo
  25   *
  26   * @package    Zend_Amf
  27   * @subpackage Value
  28   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  29   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  30   */
  31  class Zend_Amf_Value_TraitsInfo
  32  {
  33      /**
  34       * @var string Class name
  35       */
  36      protected $_className;
  37  
  38      /**
  39       * @var bool Whether or not this is a dynamic class
  40       */
  41      protected $_dynamic;
  42  
  43      /**
  44       * @var bool Whether or not the class is externalizable
  45       */
  46      protected $_externalizable;
  47  
  48      /**
  49       * @var array Class properties
  50       */
  51      protected $_properties;
  52  
  53      /**
  54       * Used to keep track of all class traits of an AMF3 object
  55       *
  56       * @param  string $className
  57       * @param  boolean $dynamic
  58       * @param  boolean $externalizable
  59       * @param  boolean $properties
  60       * @return void
  61       */
  62      public function __construct($className, $dynamic=false, $externalizable=false, $properties=null)
  63      {
  64          $this->_className      = $className;
  65          $this->_dynamic        = $dynamic;
  66          $this->_externalizable = $externalizable;
  67          $this->_properties     = $properties;
  68      }
  69  
  70      /**
  71       * Test if the class is a dynamic class
  72       *
  73       * @return boolean
  74       */
  75      public function isDynamic()
  76      {
  77          return $this->_dynamic;
  78      }
  79  
  80      /**
  81       * Test if class is externalizable
  82       *
  83       * @return boolean
  84       */
  85      public function isExternalizable()
  86      {
  87          return $this->_externalizable;
  88      }
  89  
  90      /**
  91       * Return the number of properties in the class
  92       *
  93       * @return int
  94       */
  95      public function length()
  96      {
  97          return count($this->_properties);
  98      }
  99  
 100      /**
 101       * Return the class name
 102       *
 103       * @return string
 104       */
 105      public function getClassName()
 106      {
 107          return $this->_className;
 108      }
 109  
 110      /**
 111       * Add an additional property
 112       *
 113       * @param  string $name
 114       * @return Zend_Amf_Value_TraitsInfo
 115       */
 116      public function addProperty($name)
 117      {
 118          $this->_properties[] = $name;
 119          return $this;
 120      }
 121  
 122      /**
 123       * Add all properties of the class.
 124       *
 125       * @param  array $props
 126       * @return Zend_Amf_Value_TraitsInfo
 127       */
 128      public function addAllProperties(array $props)
 129      {
 130          $this->_properties = $props;
 131          return $this;
 132      }
 133  
 134      /**
 135       * Get the property at a given index
 136       *
 137       * @param  int $index
 138       * @return string
 139       */
 140      public function getProperty($index)
 141      {
 142          return $this->_properties[(int) $index];
 143      }
 144  
 145      /**
 146       * Return all properties of the class.
 147       *
 148       * @return array
 149       */
 150      public function getAllProperties()
 151      {
 152          return $this->_properties;
 153      }
 154  }


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