-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIPipeline.php
More file actions
53 lines (46 loc) · 1.41 KB
/
IPipeline.php
File metadata and controls
53 lines (46 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/*
* Opulence
*
* @link https://www.opulencephp.com
* @copyright Copyright (C) 2021 David Young
* @license https://github.com/opulencephp/Opulence/blob/1.2/LICENSE.md
*/
namespace Opulence\Pipelines;
use Closure;
/**
* Defines the interface for pipelines to implement
*/
interface IPipeline
{
/**
* Executes the pipeline
*
* @return mixed The output of the pipeline
* @throws PipelineException Thrown if there was a problem sending the input down the pipeline
*/
public function execute();
/**
* Sets the input to send through the pipeline
*
* @param mixed $input The input to send
* @return self For method chaining
*/
public function send($input) : self;
/**
* Sets the callback to call at the end of the pipeline
*
* @param callable $callback The callback to run after the pipeline
* It must accept the result of the pipeline as a parameter
* @return self For method chaining
*/
public function then(callable $callback) : self;
/**
* Sets the list of stages in the pipeline
*
* @param Closure[]|array $stages The list of stages in the pipeline
* @param string|null $methodToCall Sets the method to call if the stages are a list of objects or class names
* @return self For method chaining
*/
public function through(array $stages, string $methodToCall = null) : self;
}