Handler::callAction()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Hivokas\LaravelHandlers;
4
5
use BadMethodCallException;
6
use Illuminate\Routing\Controller as BaseController;
7
8
abstract class Handler extends BaseController
9
{
10
    /**
11
     * Execute an action on the handler.
12
     *
13
     * @param  string  $method
14
     * @param  array   $parameters
15
     * @return \Symfony\Component\HttpFoundation\Response
16
     */
17
    public function callAction($method, $parameters)
18
    {
19
        if ($method === '__invoke') {
20
            return call_user_func_array([$this, $method], $parameters);
21
        }
22
23
        throw new BadMethodCallException('Only __invoke method can be called on handler.');
24
    }
25
}
26