/**
* @param string
* @param string
* @return array
*/
public static function parseAnnotations($class, $method = NULL)
{
if (strpos($class, '::') !== FALSE && !$method) {
list($class, $method) = explode('::', $class);
}
$ref = new Reflection\Method($class, $method);
$cRef = new Reflection\ClassType($class);
$anntations = (array)$ref->getAnnotation('allowed');
$role = isset($anntations['role']) ? $anntations['role']
: ($ref->hasAnnotation('role') ? $ref->getAnnotation('role') : NULL);
$resource = isset($anntations['resource']) ? $anntations['resource']
: ($ref->hasAnnotation('resource')
? $ref->getAnnotation('resource')
: ($cRef->hasAnnotation('resource') ? $cRef->getAnnotation('resource') : NULL));
$privilege = isset($anntations['privilege']) ? $anntations['privilege']
: ($ref->hasAnnotation('privilege') ? $ref->getAnnotation('privilege') : NULL);
return array(
static::ROLE => $role,
static::RESOURCE => $resource,
static::PRIVILEGE => $privilege,
);
}