1 | <?php |
||
25 | class Pipeline implements MiddlewarePipelineInterface |
||
26 | { |
||
27 | /** @var ConfigInterface */ |
||
28 | private $config; |
||
29 | /** @var array */ |
||
30 | private $priorityList; |
||
31 | /** @var array */ |
||
32 | private $pipelineList; |
||
33 | /** @var array */ |
||
34 | private $keyMiddlewareList; |
||
35 | /** @var int */ |
||
36 | private $index; |
||
37 | |||
38 | /** |
||
39 | * Pipeline constructor. |
||
40 | * |
||
41 | * @param ConfigInterface $pipelineConfig |
||
42 | */ |
||
43 | 3 | public function __construct(ConfigInterface $pipelineConfig) |
|
66 | |||
67 | /** |
||
68 | * Add middleware definitions to the pipeline. |
||
69 | */ |
||
70 | 3 | private function buildPipeline() |
|
82 | |||
83 | /** |
||
84 | * Checks the given class against Middleware Criterias. |
||
85 | * |
||
86 | * @param $middleWareClass |
||
87 | * |
||
88 | * @throws RuntimeException |
||
89 | * |
||
90 | * @return bool |
||
91 | */ |
||
92 | 3 | private function checkMiddleware($middleWareClass) |
|
106 | |||
107 | /** |
||
108 | * Adds a new middleware to the pipeline queue. |
||
109 | * |
||
110 | * @param string $middleWareClass |
||
111 | * @param int $priority |
||
112 | * |
||
113 | * @throws RuntimeException |
||
114 | * |
||
115 | * @return $this |
||
116 | */ |
||
117 | 3 | public function queueMiddleware($middleWareClass, $priority = 50) |
|
140 | |||
141 | /** |
||
142 | * Sorts the pipeline elements according to the priority. |
||
143 | */ |
||
144 | 2 | private function sortPipeline() |
|
153 | |||
154 | /** |
||
155 | * Starts the pipeline. |
||
156 | * |
||
157 | * @return null|string |
||
158 | */ |
||
159 | 2 | public function start() |
|
166 | |||
167 | /** |
||
168 | * Gets next element from the pipeline. |
||
169 | * |
||
170 | * @return null|string |
||
171 | */ |
||
172 | 2 | public function next() |
|
180 | |||
181 | /** |
||
182 | * Gets the full pipeline list. |
||
183 | * |
||
184 | * @return array |
||
185 | */ |
||
186 | public function getPipelineList() |
||
190 | } |
||
191 |