1+ <?php
2+
3+ namespace vennv ;
4+
5+ use Fiber ;
6+ use Throwable ;
7+
8+ interface InterfaceQueue
9+ {
10+
11+ /**
12+ * This method to get the id for the queue.
13+ */
14+ public function getId () : int ;
15+
16+ /**
17+ * This method to get the fiber for the queue.
18+ */
19+ public function getFiber () : Fiber ;
20+
21+ /**
22+ * This method to get the timeout for the queue.
23+ */
24+ public function getTimeOut () : float ;
25+
26+ /**
27+ * This method to get the status for the queue.
28+ */
29+ public function getStatus () : StatusQueue ;
30+
31+ /**
32+ * This method to set the status for the queue.
33+ */
34+ public function setStatus (StatusQueue $ status ) : void ;
35+
36+ /**
37+ * This method to check if the queue is a promise.
38+ */
39+ public function isPromise () : bool ;
40+
41+ /**
42+ * This method to get the time start for the queue.
43+ */
44+ public function getTimeStart () : float ;
45+
46+ /**
47+ * This method to get result of a queue.
48+ */
49+ public function getReturn () : mixed ;
50+
51+ /**
52+ * This method to set result of a queue.
53+ */
54+ public function setReturn (mixed $ return ) : void ;
55+
56+ /**
57+ * @throws Throwable
58+ *
59+ * This method to run a callback for a queue when the queue is fulfilled.
60+ */
61+ public function useCallableResolve (mixed $ result ) : void ;
62+
63+ /**
64+ * This method to set a callback resolve for a queue.
65+ */
66+ public function setCallableResolve (callable $ callableResolve ) : Queue ;
67+
68+ /**
69+ * @throws Throwable
70+ *
71+ * This method to run a callback for a queue when the queue is rejected.
72+ */
73+ public function useCallableReject (mixed $ result ) : void ;
74+
75+ /**
76+ * This method to set a callback reject for a queue.
77+ */
78+ public function setCallableReject (callable $ callableReject ) : Queue ;
79+
80+ /**
81+ * This method to get result of a queue when the queue is resolved.
82+ */
83+ public function getReturnResolve () : mixed ;
84+
85+ /**
86+ * This method to get result of a queue when the queue is rejected.
87+ */
88+ public function getReturnReject () : mixed ;
89+
90+ /**
91+ * This method to catch result of a queue parent when the queue is resolved.
92+ */
93+ public function thenPromise (callable $ callable ) : Queue ;
94+
95+ /**
96+ * This method to catch result of a queue parent when the queue is rejected.
97+ */
98+ public function catchPromise (callable $ callable ) : Queue ;
99+
100+ /**
101+ * This method to catch result of a queue child when the queue is resolved.
102+ */
103+ public function then (callable $ callable ) : Queue ;
104+
105+ /**
106+ * This method to catch result of a queue child when the queue is rejected.
107+ */
108+ public function catch (callable $ callable ) : Queue ;
109+
110+ /**
111+ * This method to check should drop queue when the queue is resolved or rejected.
112+ */
113+ public function canDrop () : bool ;
114+
115+ /**
116+ * @return array<callable|Async|Promise>
117+ *
118+ * This method to get waiting promises.
119+ */
120+ public function getWaitingPromises () : array ;
121+
122+ /**
123+ * @param array<callable|Async|Promise> $waitingPromises
124+ *
125+ * This method to set waiting promises.
126+ */
127+ public function setWaitingPromises (array $ waitingPromises ) : void ;
128+
129+ /**
130+ * This method check if the queue is a promise for all.
131+ */
132+ public function isPromiseAll () : bool ;
133+
134+ /**
135+ * This method to set the queue is a promise race.
136+ */
137+ public function setRacePromise (bool $ isRacePromise ) : void ;
138+
139+ /**
140+ * This method to check if the queue is a promise race.
141+ */
142+ public function isRacePromise () : bool ;
143+
144+ /**
145+ * This method to set the queue is a promise any.
146+ */
147+ public function setAnyPromise (bool $ isAnyPromise ) : void ;
148+
149+ /**
150+ * This method to check if the queue is a promise any.
151+ */
152+ public function isAnyPromise () : bool ;
153+
154+ /**
155+ * This method to set the queue is a promise all settled.
156+ */
157+ public function setAllSettled (bool $ isAllSettled ) : void ;
158+
159+ /**
160+ * This method to check if the queue is a promise all settled.
161+ */
162+ public function isAllSettled () : bool ;
163+
164+ /**
165+ * @throws Throwable
166+ *
167+ * This method to check if the queue has completed all promises.
168+ */
169+ public function hasCompletedAllPromises () : bool ;
170+
171+ }
0 commit comments