File indexing completed on 2024-12-22 05:37:01
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_Server 0017 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0018 * @license http://framework.zend.com/license/new-bsd New BSD License 0019 */ 0020 0021 /** 0022 * Zend_Server_Reflection_Function_Abstract 0023 */ 0024 // require_once 'Zend/Server/Reflection/Function/Abstract.php'; 0025 0026 /** 0027 * Method Reflection 0028 * 0029 * @uses Zend_Server_Reflection_Function_Abstract 0030 * @category Zend 0031 * @package Zend_Server 0032 * @subpackage Reflection 0033 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0034 * @license http://framework.zend.com/license/new-bsd New BSD License 0035 * @version $Id$ 0036 */ 0037 class Zend_Server_Reflection_Method extends Zend_Server_Reflection_Function_Abstract 0038 { 0039 /** 0040 * Parent class name 0041 * @var string 0042 */ 0043 protected $_class; 0044 0045 /** 0046 * Parent class reflection 0047 * @var Zend_Server_Reflection_Class 0048 */ 0049 protected $_classReflection; 0050 0051 /** 0052 * Constructor 0053 * 0054 * @param Zend_Server_Reflection_Class $class 0055 * @param ReflectionMethod $r 0056 * @param string $namespace 0057 * @param array $argv 0058 * @return void 0059 */ 0060 public function __construct(Zend_Server_Reflection_Class $class, ReflectionMethod $r, $namespace = null, $argv = array()) 0061 { 0062 $this->_classReflection = $class; 0063 $this->_reflection = $r; 0064 0065 $classNamespace = $class->getNamespace(); 0066 0067 // Determine namespace 0068 if (!empty($namespace)) { 0069 $this->setNamespace($namespace); 0070 } elseif (!empty($classNamespace)) { 0071 $this->setNamespace($classNamespace); 0072 } 0073 0074 // Determine arguments 0075 if (is_array($argv)) { 0076 $this->_argv = $argv; 0077 } 0078 0079 // If method call, need to store some info on the class 0080 $this->_class = $class->getName(); 0081 0082 // Perform some introspection 0083 $this->_reflect(); 0084 } 0085 0086 /** 0087 * Return the reflection for the class that defines this method 0088 * 0089 * @return Zend_Server_Reflection_Class 0090 */ 0091 public function getDeclaringClass() 0092 { 0093 return $this->_classReflection; 0094 } 0095 0096 /** 0097 * Wakeup from serialization 0098 * 0099 * Reflection needs explicit instantiation to work correctly. Re-instantiate 0100 * reflection object on wakeup. 0101 * 0102 * @return void 0103 */ 0104 public function __wakeup() 0105 { 0106 $this->_classReflection = new Zend_Server_Reflection_Class(new ReflectionClass($this->_class), $this->getNamespace(), $this->getInvokeArguments()); 0107 $this->_reflection = new ReflectionMethod($this->_classReflection->getName(), $this->getName()); 0108 } 0109 0110 }