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
コード例 #1
0
 /**
  * Magic accessor
  *
  * @param string $name Key name
  *
  * @throws \InvalidArgumentException if referenced value is not an advisor
  * @return Advice
  */
 public function __get($name)
 {
     if ($this->container->has($name)) {
         $advisor = $this->container->get($name);
     } else {
         list(, $advisorName) = explode('.', $name);
         list($aspect) = explode('->', $advisorName);
         $aspectInstance = $this->container->getAspect($aspect);
         $this->loader->loadAndRegister($aspectInstance);
         $advisor = $this->container->get($name);
     }
     if (!$advisor instanceof Advisor) {
         throw new \InvalidArgumentException("Reference {$name} is not an advisor");
     }
     $this->{$name} = $advisor->getAdvice();
     return $this->{$name};
 }