|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00032 class Zend_Server_Method_Parameter 00033 { 00037 protected $_defaultValue; 00038 00042 protected $_description = ''; 00043 00047 protected $_name; 00048 00052 protected $_optional = false; 00053 00057 protected $_type = 'mixed'; 00058 00065 public function __construct($options = null) 00066 { 00067 if (is_array($options)) { 00068 $this->setOptions($options); 00069 } 00070 } 00071 00078 public function setOptions(array $options) 00079 { 00080 foreach ($options as $key => $value) { 00081 $method = 'set' . ucfirst($key); 00082 if (method_exists($this, $method)) { 00083 $this->$method($value); 00084 } 00085 } 00086 return $this; 00087 } 00088 00095 public function setDefaultValue($defaultValue) 00096 { 00097 $this->_defaultValue = $defaultValue; 00098 return $this; 00099 } 00100 00106 public function getDefaultValue() 00107 { 00108 return $this->_defaultValue; 00109 } 00110 00117 public function setDescription($description) 00118 { 00119 $this->_description = (string) $description; 00120 return $this; 00121 } 00122 00128 public function getDescription() 00129 { 00130 return $this->_description; 00131 } 00132 00139 public function setName($name) 00140 { 00141 $this->_name = (string) $name; 00142 return $this; 00143 } 00144 00150 public function getName() 00151 { 00152 return $this->_name; 00153 } 00154 00161 public function setOptional($flag) 00162 { 00163 $this->_optional = (bool) $flag; 00164 return $this; 00165 } 00166 00172 public function isOptional() 00173 { 00174 return $this->_optional; 00175 } 00176 00183 public function setType($type) 00184 { 00185 $this->_type = (string) $type; 00186 return $this; 00187 } 00188 00194 public function getType() 00195 { 00196 return $this->_type; 00197 } 00198 00204 public function toArray() 00205 { 00206 return array( 00207 'type' => $this->getType(), 00208 'name' => $this->getName(), 00209 'optional' => $this->isOptional(), 00210 'defaultValue' => $this->getDefaultValue(), 00211 'description' => $this->getDescription(), 00212 ); 00213 } 00214 }