File indexing completed on 2024-12-22 05:36:27
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Amf 0017 * @subpackage Value 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** 0024 * Zend_Amf_Value_TraitsInfo 0025 * 0026 * @package Zend_Amf 0027 * @subpackage Value 0028 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0029 * @license http://framework.zend.com/license/new-bsd New BSD License 0030 */ 0031 class Zend_Amf_Value_TraitsInfo 0032 { 0033 /** 0034 * @var string Class name 0035 */ 0036 protected $_className; 0037 0038 /** 0039 * @var bool Whether or not this is a dynamic class 0040 */ 0041 protected $_dynamic; 0042 0043 /** 0044 * @var bool Whether or not the class is externalizable 0045 */ 0046 protected $_externalizable; 0047 0048 /** 0049 * @var array Class properties 0050 */ 0051 protected $_properties; 0052 0053 /** 0054 * Used to keep track of all class traits of an AMF3 object 0055 * 0056 * @param string $className 0057 * @param boolean $dynamic 0058 * @param boolean $externalizable 0059 * @param boolean $properties 0060 * @return void 0061 */ 0062 public function __construct($className, $dynamic=false, $externalizable=false, $properties=null) 0063 { 0064 $this->_className = $className; 0065 $this->_dynamic = $dynamic; 0066 $this->_externalizable = $externalizable; 0067 $this->_properties = $properties; 0068 } 0069 0070 /** 0071 * Test if the class is a dynamic class 0072 * 0073 * @return boolean 0074 */ 0075 public function isDynamic() 0076 { 0077 return $this->_dynamic; 0078 } 0079 0080 /** 0081 * Test if class is externalizable 0082 * 0083 * @return boolean 0084 */ 0085 public function isExternalizable() 0086 { 0087 return $this->_externalizable; 0088 } 0089 0090 /** 0091 * Return the number of properties in the class 0092 * 0093 * @return int 0094 */ 0095 public function length() 0096 { 0097 return count($this->_properties); 0098 } 0099 0100 /** 0101 * Return the class name 0102 * 0103 * @return string 0104 */ 0105 public function getClassName() 0106 { 0107 return $this->_className; 0108 } 0109 0110 /** 0111 * Add an additional property 0112 * 0113 * @param string $name 0114 * @return Zend_Amf_Value_TraitsInfo 0115 */ 0116 public function addProperty($name) 0117 { 0118 $this->_properties[] = $name; 0119 return $this; 0120 } 0121 0122 /** 0123 * Add all properties of the class. 0124 * 0125 * @param array $props 0126 * @return Zend_Amf_Value_TraitsInfo 0127 */ 0128 public function addAllProperties(array $props) 0129 { 0130 $this->_properties = $props; 0131 return $this; 0132 } 0133 0134 /** 0135 * Get the property at a given index 0136 * 0137 * @param int $index 0138 * @return string 0139 */ 0140 public function getProperty($index) 0141 { 0142 return $this->_properties[(int) $index]; 0143 } 0144 0145 /** 0146 * Return all properties of the class. 0147 * 0148 * @return array 0149 */ 0150 public function getAllProperties() 0151 { 0152 return $this->_properties; 0153 } 0154 }