Caller   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\Jaravel\Services;
6
7
use Illuminate\Support\Facades\App;
8
use Umbrellio\Jaravel\Services\Exceptions\CallerException;
9
10
class Caller
11
{
12
    public static function call($callable, array $params)
13
    {
14
        if (is_callable($callable)) {
15
            return $callable(...$params);
16
        }
17
18
        if (is_string($callable)) {
19
            $callableObject = App::make($callable);
20
21
            return $callableObject(...$params);
22
        }
23
24
        throw new CallerException('Unexpected callable parameter');
25
    }
26
}
27