public function load(Aspect $aspect, $reflection, $metaInformation = null)
{
$loadedItems = [];
$pointcut = $this->parsePointcut($aspect, $reflection, $metaInformation);
$methodId = get_class($aspect) . '->' . $reflection->name;
$adviceCallback = $reflection->getClosure($aspect);
switch (true) {
// Register a pointcut by its name
case $metaInformation instanceof Annotation\Pointcut:
$loadedItems[$methodId] = $pointcut;
break;
case $pointcut instanceof PointFilter:
$advice = $this->getInterceptor($metaInformation, $adviceCallback);
$loadedItems[$methodId] = new DefaultPointcutAdvisor($pointcut, $advice);
break;
default:
throw new \UnexpectedValueException("Unsupported pointcut class: " . get_class($pointcut));
}
return $loadedItems;
}