public registerPointcut ( Go\Aop\Pointcut $pointcut, string $id ) | ||
$pointcut | Go\Aop\Pointcut | Instance |
$id | string | Key for pointcut |
public function registerPointcut(Aop\Pointcut $pointcut, $id)
{
$this->set("pointcut.{$id}", $pointcut, array('pointcut'));
}
/** * Tests that pointcut can be registered and accessed */ public function testPointcutCanBeRegisteredAndReceived() { $pointcut = $this->getMock(Pointcut::class); $this->container->registerPointcut($pointcut, 'test'); $this->assertSame($pointcut, $this->container->getPointcut('test')); // Verify that tag is working $pointcuts = $this->container->getByTag('pointcut'); $this->assertSame(array('pointcut.test' => $pointcut), $pointcuts); }