Conditions | 4 |
Paths | 2 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
23 | 12 | public function __call($method, $params) |
|
24 | { |
||
25 | 12 | $pipeline = new Pipeline(app()); |
|
26 | |||
27 | 12 | if (!is_string($this->callable)) { |
|
28 | // for method calls on objects. |
||
29 | $core = (function ($params) use ($method) { |
||
30 | try { |
||
31 | 4 | return $this->$method(...$params); |
|
32 | 1 | } catch (\Throwable $e) { |
|
33 | 1 | return $e; |
|
34 | } |
||
35 | 6 | })->bindTo($this->callable, $this->callable); |
|
36 | } else { |
||
37 | // for static method calls on classes. |
||
38 | $core = function ($params) use ($method) { |
||
39 | try { |
||
40 | 3 | return call_user_func_array([$this->callable, $method], $params); |
|
41 | 2 | } catch (\Throwable $e) { |
|
42 | 2 | return $e; |
|
43 | } |
||
44 | 6 | }; |
|
45 | } |
||
46 | |||
47 | 12 | return $this->sendItThroughPipes($params, $pipeline, $core); |
|
48 | } |
||
49 | |||
69 |