| Conditions | 4 |
| Paths | 4 |
| Total Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4.1054 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 8 | public function __call($method, $params) |
|
| 24 | { |
||
| 25 | 8 | $pipeline = new Pipeline(app()); |
|
| 26 | |||
| 27 | 8 | if (!is_string($this->callable)) { |
|
| 28 | $core = (function ($params) use ($method) { |
||
| 29 | try { |
||
| 30 | 3 | return $this->$method(...$params); |
|
| 31 | } catch (\Throwable $e) { |
||
| 32 | return $e; |
||
| 33 | } |
||
| 34 | 5 | })->bindTo($this->callable, $this->callable); |
|
| 35 | } else { |
||
| 36 | $core = function ($params) use ($method) { |
||
| 37 | 1 | return call_user_func_array([$this->callable, $method], $params); |
|
| 38 | 3 | }; |
|
| 39 | } |
||
| 40 | |||
| 41 | $result = $pipeline |
||
| 42 | 8 | ->via('handle') |
|
| 43 | 8 | ->send($params) |
|
| 44 | 8 | ->through($this->middlewares) |
|
| 45 | 8 | ->then($core); |
|
| 46 | |||
| 47 | 8 | if ($result instanceof \Throwable) { |
|
| 48 | throw $result; |
||
| 49 | } else { |
||
| 50 | 8 | return $result; |
|
| 51 | } |
||
| 52 | } |
||
| 53 | } |
||
| 54 |