RunnerLee /
pipeline
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @author: RunnerLee |
||
| 4 | * @email: [email protected] |
||
| 5 | * @time: 2018-12 |
||
| 6 | */ |
||
| 7 | |||
| 8 | namespace Runner\Pipeline; |
||
| 9 | |||
| 10 | use Runner\Pipeline\Contracts\Stage as StageInterface; |
||
| 11 | |||
| 12 | class Stage implements StageInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var callable |
||
| 16 | */ |
||
| 17 | protected $callback; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var Stage|null |
||
| 21 | */ |
||
| 22 | protected $next; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Stage constructor. |
||
| 26 | * |
||
| 27 | * @param $callback |
||
| 28 | * @param Stage|null $next |
||
| 29 | */ |
||
| 30 | 1 | public function __construct($callback, self $next = null) |
|
| 31 | { |
||
| 32 | 1 | $this->callback = $callback; |
|
| 33 | 1 | $this->next = $next; |
|
| 34 | 1 | } |
|
| 35 | |||
| 36 | /** |
||
| 37 | * @param $payload |
||
| 38 | * |
||
| 39 | * @return mixed |
||
| 40 | */ |
||
| 41 | 1 | public function handle($payload) |
|
| 42 | { |
||
| 43 | // destination callback (without next stage) |
||
| 44 | 1 | if (is_null($this->next)) { |
|
| 45 | 1 | return call_user_func($this->callback, $payload); |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | return call_user_func($this->callback, $payload, function ($payload) { |
|
| 49 | 1 | return $this->next->handle($payload); |
|
|
0 ignored issues
–
show
|
|||
| 50 | 1 | }); |
|
| 51 | } |
||
| 52 | } |
||
| 53 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.