1 | <?php |
||
15 | class Pipeline implements \IteratorAggregate, \Countable |
||
16 | { |
||
17 | private const PRIORITY_BUILDING = 1; |
||
18 | private const PRIORITY_EXTENSIONS = 2; |
||
19 | private const PRIORITY_TYPE_RESOLVING = 3; |
||
20 | private const PRIORITY_RUNTIME = 4; |
||
21 | |||
22 | /** |
||
23 | * Example struct: |
||
24 | * |
||
25 | * <code> |
||
26 | * [ |
||
27 | * PRIORITY_1 => \SplQueue([1, 2, 3]), |
||
28 | * PRIORITY_2 => \SplQueue([1, 2, 3]), |
||
29 | * PRIORITY_3 => \SplQueue([1, 2, 3]), |
||
30 | * ] |
||
31 | * </code> |
||
32 | * |
||
33 | * @var \SplQueue[] |
||
34 | */ |
||
35 | private $queue = []; |
||
36 | |||
37 | /** |
||
38 | * @return \Traversable|callable[] |
||
39 | */ |
||
40 | 1 | public function getIterator(): \Traversable |
|
46 | |||
47 | /** |
||
48 | * @return null|callable |
||
49 | */ |
||
50 | 1 | private function next(): ?callable |
|
60 | |||
61 | /** |
||
62 | * @param \Closure $then |
||
63 | */ |
||
64 | public function building(\Closure $then): void |
||
68 | |||
69 | /** |
||
70 | * @param \Closure $then |
||
71 | */ |
||
72 | public function extending(\Closure $then): void |
||
76 | |||
77 | /** |
||
78 | * @param \Closure $then |
||
79 | */ |
||
80 | 1 | public function resolving(\Closure $then): void |
|
84 | |||
85 | /** |
||
86 | * @param \Closure $then |
||
87 | */ |
||
88 | 1 | public function runtime(\Closure $then): void |
|
92 | |||
93 | /** |
||
94 | * @param int $priority |
||
95 | * @param callable $then |
||
96 | */ |
||
97 | 1 | public function push(int $priority, callable $then): void |
|
105 | |||
106 | /** |
||
107 | * @return \SplDoublyLinkedList |
||
108 | */ |
||
109 | 1 | protected function createList(): \SplDoublyLinkedList |
|
113 | |||
114 | /** |
||
115 | * @return int |
||
116 | */ |
||
117 | public function count(): int |
||
123 | |||
124 | /** |
||
125 | * @return callable |
||
126 | * @throws \UnderflowException |
||
127 | */ |
||
128 | public function pop(): callable |
||
138 | |||
139 | /** |
||
140 | * @param \Closure $each |
||
141 | */ |
||
142 | public function reduce(\Closure $each): void |
||
148 | } |
||
149 |