Go\Core\GoAspectContainer::registerPointcut PHP Method

registerPointcut() public method

Store the pointcut in the container
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'));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * 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);
 }