3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Server\Reflection
;
15 class ReflectionMethod
extends AbstractFunction
24 * Parent class reflection
25 * @var ReflectionClass
27 protected $classReflection;
32 * @param ReflectionClass $class
33 * @param \ReflectionMethod $r
34 * @param string $namespace
37 public function __construct(ReflectionClass
$class, \ReflectionMethod
$r, $namespace = null, $argv = array())
39 $this->classReflection
= $class;
40 $this->reflection
= $r;
42 $classNamespace = $class->getNamespace();
44 // Determine namespace
45 if (!empty($namespace)) {
46 $this->setNamespace($namespace);
47 } elseif (!empty($classNamespace)) {
48 $this->setNamespace($classNamespace);
51 // Determine arguments
52 if (is_array($argv)) {
56 // If method call, need to store some info on the class
57 $this->class = $class->getName();
59 // Perform some introspection
64 * Return the reflection for the class that defines this method
66 * @return \Zend\Server\Reflection\ReflectionClass
68 public function getDeclaringClass()
70 return $this->classReflection
;
74 * Wakeup from serialization
76 * Reflection needs explicit instantiation to work correctly. Re-instantiate
77 * reflection object on wakeup.
81 public function __wakeup()
83 $this->classReflection
= new ReflectionClass(new \
ReflectionClass($this->class), $this->getNamespace(), $this->getInvokeArguments());
84 $this->reflection
= new \
ReflectionMethod($this->classReflection
->getName(), $this->getName());