Test Failed
Pull Request — master (#1117)
by Aleksei
15:44
created

CallableHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 8
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Interceptors\Handler;
6
7
use Spiral\Interceptors\Context\CallContextInterface;
8
use Spiral\Interceptors\HandlerInterface;
9
10
/**
11
 * Handler that just invokes PHP callable without any additional logic.
12
 */
13
final class CallableHandler implements HandlerInterface
14
{
15
    public function handle(CallContextInterface $context): mixed
16
    {
17
        $callable = $context->getTarget()->getCallable();
18
        \is_callable($callable) or throw new \RuntimeException('Callable not found in the call context.');
19
20
        return $callable(...$context->getArguments());
21
    }
22
}
23