/** * Returns an array of reflection parameter instances from the passed reflection method. * * @param \AppserverIo\Lang\Reflection\ReflectionMethod $reflectionMethod The reflection method to return the parameters for * * @return array An array with ReflectionParameter instances */ public static function fromReflectionMethod(ReflectionMethod $reflectionMethod) { // initialize the array for the reflection parameters $reflectionParameters = array(); // load the reflection parameters and initialize the array with the reflection parameters $phpReflectionMethod = $reflectionMethod->toPhpReflectionMethod(); foreach ($phpReflectionMethod->getParameters() as $phpReflectionParameter) { $reflectionParameters[$phpReflectionParameter->getName()] = ReflectionParameter::fromPhpReflectionParameter($phpReflectionParameter); } // return the array with the initialized reflection parameters return $reflectionParameters; }
/** * Creates a new reflection method instance from the passed PHP reflection method. * * @param \ReflectionMethod $reflectionMethod The reflection method to load the data from * @param array $annotationsToIgnore An array with annotations names we want to ignore when loaded * @param array $annotationAliases An array with annotation aliases used when create annotation instances * * @return \AppserverIo\Lang\Reflection\ReflectionMethod The instance */ public static function fromPhpReflectionMethod(\ReflectionMethod $reflectionMethod, array $annotationsToIgnore = array(), array $annotationAliases = array()) { // load class and method name from the reflection class $className = $reflectionMethod->getDeclaringClass()->getName(); $methodName = $reflectionMethod->getName(); // initialize and return the timeout method instance return new ReflectionMethod($className, $methodName, $annotationsToIgnore, $annotationAliases); }
/** * Returns the class methods. * * @param integer $filter Filter the results to include only methods with certain attributes * * @return array The class methods * @see \AppserverIo\Lang\Reflection\ClassInterface::getMethods() * @link http://php.net/manual/en/reflectionclass.getmethods.php */ public function getMethods($filter = ReflectionProperty::ALL_MODIFIERS) { // check if the methods for the requested filter has been loaded if (isset($this->methods[$filter]) === false) { $this->methods[$filter] = ReflectionMethod::fromReflectionClass($this, $filter, $this->getAnnotationsToIgnore(), $this->getAnnotationAliases()); } // return the requested method return $this->methods[$filter]; }