public function load(Aspect $aspect, $reflection, $metaInformation = null)
{
$loadedItems = [];
$pointcut = $this->parsePointcut($aspect, $reflection, $metaInformation);
$propertyId = $reflection->class . '->' . $reflection->name;
switch (true) {
case $metaInformation instanceof Annotation\DeclareParents:
$interface = $metaInformation->interface;
$implement = $metaInformation->defaultImpl;
$advice = new Framework\TraitIntroductionInfo($interface, $implement);
$advisor = new Support\DeclareParentsAdvisor($pointcut->getClassFilter(), $advice);
$loadedItems[$propertyId] = $advisor;
break;
case $metaInformation instanceof Annotation\DeclareError:
$reflection->setAccessible(true);
$message = $reflection->getValue($aspect);
$level = $metaInformation->level;
$advice = new Framework\DeclareErrorInterceptor($message, $level, $metaInformation->value);
$loadedItems[$propertyId] = new Support\DefaultPointcutAdvisor($pointcut, $advice);
break;
default:
throw new \UnexpectedValueException("Unsupported pointcut class: " . get_class($pointcut));
}
return $loadedItems;
}