1 | <?php |
||
18 | class Storage implements \IteratorAggregate, \Countable |
||
19 | { |
||
20 | /** |
||
21 | * @var int |
||
22 | */ |
||
23 | private $id = 0; |
||
24 | |||
25 | /** |
||
26 | * @var Map<TypeNameInterface|int,DeferredInterface> |
||
27 | */ |
||
28 | private $deferred; |
||
29 | |||
30 | /** |
||
31 | * Storage constructor. |
||
32 | */ |
||
33 | public function __construct() |
||
37 | |||
38 | /** |
||
39 | * @param DeferredInterface $deferred |
||
40 | * @return DeferredInterface |
||
41 | */ |
||
42 | public function add(DeferredInterface $deferred): DeferredInterface |
||
48 | |||
49 | /** |
||
50 | * @param TypeNameInterface $name |
||
51 | * @return null|DeferredInterface |
||
52 | */ |
||
53 | public function first(TypeNameInterface $name): ?DeferredInterface |
||
57 | |||
58 | /** |
||
59 | * @param \Closure $filter |
||
60 | * @return iterable |
||
61 | */ |
||
62 | public function only(\Closure $filter): iterable |
||
70 | |||
71 | /** |
||
72 | * @param \Closure $filter |
||
73 | * @return iterable|DeferredInterface[] |
||
74 | */ |
||
75 | public function extract(\Closure $filter): iterable |
||
85 | |||
86 | /** |
||
87 | * @return iterable|DeferredInterface[] |
||
88 | */ |
||
89 | public function getIterator(): iterable |
||
95 | |||
96 | /** |
||
97 | * @return int |
||
98 | */ |
||
99 | public function count(): int |
||
103 | } |
||
104 |