public function __construct(ReflectionClass $parent, array $classAdvices)
{
parent::__construct($classAdvices);
$this->class = $parent;
$this->name = $parent->getShortName();
$this->parentClassName = $parent->getShortName();
$this->addInterface('\\Go\\Aop\\Proxy');
$this->addJoinpointsProperty();
foreach ($classAdvices as $type => $typedAdvices) {
switch ($type) {
case AspectContainer::METHOD_PREFIX:
case AspectContainer::STATIC_METHOD_PREFIX:
foreach ($typedAdvices as $joinPointName => $advice) {
$method = $parent->getMethod($joinPointName);
$this->overrideMethod($method);
}
break;
case AspectContainer::PROPERTY_PREFIX:
foreach ($typedAdvices as $joinPointName => $advice) {
$property = $parent->getProperty($joinPointName);
$this->interceptProperty($property);
}
break;
case AspectContainer::INTRODUCTION_TRAIT_PREFIX:
foreach ($typedAdvices as $advice) {
/** @var $advice IntroductionInfo */
foreach ($advice->getInterfaces() as $interface) {
$this->addInterface($interface);
}
foreach ($advice->getTraits() as $trait) {
$this->addTrait($trait);
}
}
break;
case AspectContainer::INIT_PREFIX:
case AspectContainer::STATIC_INIT_PREFIX:
break;
// No changes for class
// No changes for class
default:
throw new \InvalidArgumentException("Unsupported point `{$type}`");
}
}
}