/** * Returns an array of reflection method instances from the passed reflection class. * * @param \AppserverIo\Lang\Reflection\ReflectionClass $reflectionClass The reflection class to return the methods for * @param integer $filter The filter used for loading the methods * @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 array An array with ReflectionMethod instances */ public static function fromReflectionClass(ReflectionClass $reflectionClass, $filter = -1, array $annotationsToIgnore = array(), array $annotationAliases = array()) { // initialize the array for the reflection methods $reflectionMethods = array(); // load the reflection methods and initialize the array with the reflection methods $phpReflectionClass = $reflectionClass->toPhpReflectionClass(); foreach ($phpReflectionClass->getMethods($filter) as $phpReflectionMethod) { $reflectionMethods[$phpReflectionMethod->getName()] = ReflectionMethod::fromPhpReflectionMethod($phpReflectionMethod, $annotationsToIgnore, $annotationAliases); } // return the array with the initialized reflection methods return $reflectionMethods; }
/** * Returns an array of reflection property instances from the passed reflection class. * * @param \AppserverIo\Lang\Reflection\ReflectionClass $reflectionClass The reflection class to return the properties for * @param integer $filter The filter used for loading the properties * @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 array An array with ReflectionProperty instances */ public static function fromReflectionClass(ReflectionClass $reflectionClass, $filter = 0, array $annotationsToIgnore = array(), array $annotationAliases = array()) { // initialize the array for the reflection properties $reflectionProperties = array(); // load the reflection properties and initialize the array with the reflection properties $phpReflectionClass = $reflectionClass->toPhpReflectionClass(); foreach ($phpReflectionClass->getProperties($filter) as $phpReflectionProperty) { $reflectionProperties[$phpReflectionProperty->getName()] = ReflectionProperty::fromPhpReflectionProperty($phpReflectionProperty, $annotationsToIgnore, $annotationAliases); } // return the array with the initialized reflection properties return $reflectionProperties; }