|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00024 require_once 'Zend/Server/Reflection/Method.php'; 00025 00039 class Zend_Server_Reflection_Class 00040 { 00046 protected $_config = array(); 00047 00052 protected $_methods = array(); 00053 00058 protected $_namespace = null; 00059 00064 protected $_reflection; 00065 00077 public function __construct(ReflectionClass $reflection, $namespace = null, $argv = false) 00078 { 00079 $this->_reflection = $reflection; 00080 $this->setNamespace($namespace); 00081 00082 foreach ($reflection->getMethods() as $method) { 00083 // Don't aggregate magic methods 00084 if ('__' == substr($method->getName(), 0, 2)) { 00085 continue; 00086 } 00087 00088 if ($method->isPublic()) { 00089 // Get signatures and description 00090 $this->_methods[] = new Zend_Server_Reflection_Method($this, $method, $this->getNamespace(), $argv); 00091 } 00092 } 00093 } 00094 00102 public function __call($method, $args) 00103 { 00104 if (method_exists($this->_reflection, $method)) { 00105 return call_user_func_array(array($this->_reflection, $method), $args); 00106 } 00107 00108 require_once 'Zend/Server/Reflection/Exception.php'; 00109 throw new Zend_Server_Reflection_Exception('Invalid reflection method'); 00110 } 00111 00121 public function __get($key) 00122 { 00123 if (isset($this->_config[$key])) { 00124 return $this->_config[$key]; 00125 } 00126 00127 return null; 00128 } 00129 00139 public function __set($key, $value) 00140 { 00141 $this->_config[$key] = $value; 00142 } 00143 00150 public function getMethods() 00151 { 00152 return $this->_methods; 00153 } 00154 00160 public function getNamespace() 00161 { 00162 return $this->_namespace; 00163 } 00164 00171 public function setNamespace($namespace) 00172 { 00173 if (empty($namespace)) { 00174 $this->_namespace = ''; 00175 return; 00176 } 00177 00178 if (!is_string($namespace) || !preg_match('/[a-z0-9_\.]+/i', $namespace)) { 00179 require_once 'Zend/Server/Reflection/Exception.php'; 00180 throw new Zend_Server_Reflection_Exception('Invalid namespace'); 00181 } 00182 00183 $this->_namespace = $namespace; 00184 } 00185 00194 public function __wakeup() 00195 { 00196 $this->_reflection = new ReflectionClass($this->getName()); 00197 } 00198 }