1 | <?php |
||
15 | class Pipeline implements \IteratorAggregate, \Countable |
||
16 | { |
||
17 | /** |
||
18 | * @var int |
||
19 | */ |
||
20 | public const PRIORITY_DEFINITION = 0x01; |
||
21 | |||
22 | /** |
||
23 | * @var int |
||
24 | */ |
||
25 | public const PRIORITY_EXTENSION = 0x02; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | public const PRIORITY_INVOCATION = 0x03; |
||
31 | |||
32 | /** |
||
33 | * Example struct: |
||
34 | * |
||
35 | * <code> |
||
36 | * [ |
||
37 | * PRIORITY_1 => \SplQueue([1, 2, 3]), |
||
38 | * PRIORITY_2 => \SplQueue([1, 2, 3]), |
||
39 | * PRIORITY_3 => \SplQueue([1, 2, 3]), |
||
40 | * ] |
||
41 | * </code> |
||
42 | * |
||
43 | * @var \SplQueue[] |
||
44 | */ |
||
45 | private $queue = []; |
||
46 | |||
47 | /** |
||
48 | * @return \Traversable|callable[] |
||
49 | */ |
||
50 | public function getIterator(): \Traversable |
||
56 | |||
57 | /** |
||
58 | * @return null|callable |
||
59 | */ |
||
60 | private function next(): ?callable |
||
70 | |||
71 | /** |
||
72 | * @param int $priority |
||
73 | * @param callable $then |
||
74 | */ |
||
75 | public function push(int $priority, callable $then): void |
||
83 | |||
84 | /** |
||
85 | * @return \SplDoublyLinkedList |
||
86 | */ |
||
87 | protected function createList(): \SplDoublyLinkedList |
||
91 | |||
92 | /** |
||
93 | * @return int |
||
94 | */ |
||
95 | public function count(): int |
||
101 | |||
102 | /** |
||
103 | * @return callable |
||
104 | * @throws \UnderflowException |
||
105 | */ |
||
106 | public function pop(): callable |
||
116 | } |
||
117 |