Passed
Pull Request — master (#318)
by Sam
03:54
created

CallableMiddleware::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\GraphQL\Error\Handler;
4
5
use Digia\GraphQL\Execution\ExecutionContext;
6
use Digia\GraphQL\Execution\ExecutionException;
7
8
class CallableMiddleware extends AbstractErrorMiddleware
9
{
10
    /**
11
     * @var callable
12
     */
13
    protected $handleCallback;
14
15
    /**
16
     * CallableMiddleware constructor.
17
     * @param callable $handleCallback
18
     */
19
    public function __construct(callable $handleCallback)
20
    {
21
        $this->handleCallback = $handleCallback;
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function handleExecutionError(ExecutionException $exception, ExecutionContext $context, callable $next)
28
    {
29
        return \call_user_func($this->handleCallback, $exception, $context, $next);
30
    }
31
}
32