Go\Core\GoAspectContainer::getAspect PHP Method

getAspect() public method

Returns an aspect by id or class name
public getAspect ( string $aspectName ) : Go\Aop\Aspect
$aspectName string Aspect name
return Go\Aop\Aspect
    public function getAspect($aspectName)
    {
        return $this->get("aspect.{$aspectName}");
    }

Usage Example

 /**
  * Tests that aspect can be registered and accessed
  */
 public function testAspectCanBeRegisteredAndReceived()
 {
     $aspect = $this->getMock(Aspect::class);
     $aspectClass = get_class($aspect);
     $this->container->registerAspect($aspect);
     $this->assertSame($aspect, $this->container->getAspect($aspectClass));
     // Verify that tag is working
     $aspects = $this->container->getByTag('aspect');
     $this->assertSame(array("aspect.{$aspectClass}" => $aspect), $aspects);
 }