Tolerance\Bridge\JMSAopBundle\Operation\RunnerRepository::getRunnerByMethod PHP Method

getRunnerByMethod() public method

public getRunnerByMethod ( ReflectionMethod $method ) : Tolerance\Operation\Runner\OperationRunner | null
$method ReflectionMethod
return Tolerance\Operation\Runner\OperationRunner | null
    public function getRunnerByMethod(\ReflectionMethod $method)
    {
        $class = new \ReflectionClass($method->class);
        $className = $class->name;
        if (!array_key_exists($className, $this->runnerMappings)) {
            return;
        }
        $methodName = $method->name;
        if (!array_key_exists($methodName, $this->runnerMappings[$className])) {
            return;
        }
        return $this->runnerMappings[$className][$methodName];
    }

Usage Example

Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function intercept(MethodInvocation $invocation)
 {
     $operation = new Callback(function () use($invocation) {
         return $invocation->proceed();
     });
     if (null === ($runner = $this->runnerRepository->getRunnerByMethod($invocation->reflection))) {
         return $operation->call();
     }
     return $runner->run($operation);
 }
All Usage Examples Of Tolerance\Bridge\JMSAopBundle\Operation\RunnerRepository::getRunnerByMethod