PluginProbe ʕ •ᴥ•ʔ
Check & Log Email – Easy Email Testing & Mail logging / 2.0.15
Check & Log Email – Easy Email Testing & Mail logging v2.0.15
2.0.15 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 2.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.13.1 2.0.13.2 2.0.14 2.0.2 2.0.3 2.0.4 2.0.5 2.0.5.1 2.0.6 2.0.7 2.0.8 2.0.9 trunk 0.5.7 0.6.0 0.6.1 0.6.2 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.12.1 1.0.13 1.0.13.1 1.0.2 1.0.3
check-email / vendor / guzzlehttp / promises / src / PromiseInterface.php
check-email / vendor / guzzlehttp / promises / src Last commit date
AggregateException.php 1 week ago CancellationException.php 1 week ago Coroutine.php 1 week ago Create.php 1 week ago Each.php 1 week ago EachPromise.php 1 week ago FulfilledPromise.php 1 week ago Is.php 1 week ago Promise.php 1 week ago PromiseInterface.php 1 week ago PromisorInterface.php 1 week ago RejectedPromise.php 1 week ago RejectionException.php 1 week ago TaskQueue.php 1 week ago TaskQueueInterface.php 1 week ago Utils.php 1 week ago
PromiseInterface.php
92 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace GuzzleHttp\Promise;
6
7 /**
8 * A promise represents the eventual result of an asynchronous operation.
9 *
10 * The primary way of interacting with a promise is through its then method,
11 * which registers callbacks to receive either a promise’s eventual value or
12 * the reason why the promise cannot be fulfilled.
13 *
14 * @see https://promisesaplus.com/
15 */
16 interface PromiseInterface
17 {
18 public const PENDING = 'pending';
19 public const FULFILLED = 'fulfilled';
20 public const REJECTED = 'rejected';
21
22 /**
23 * Appends fulfillment and rejection handlers to the promise, and returns
24 * a new promise resolving to the return value of the called handler.
25 *
26 * @param callable $onFulfilled Invoked when the promise fulfills.
27 * @param callable $onRejected Invoked when the promise is rejected.
28 */
29 public function then(
30 ?callable $onFulfilled = null,
31 ?callable $onRejected = null
32 ): PromiseInterface;
33
34 /**
35 * Appends a rejection handler callback to the promise, and returns a new
36 * promise resolving to the return value of the callback if it is called,
37 * or to its original fulfillment value if the promise is instead
38 * fulfilled.
39 *
40 * @param callable $onRejected Invoked when the promise is rejected.
41 */
42 public function otherwise(callable $onRejected): PromiseInterface;
43
44 /**
45 * Get the state of the promise ("pending", "rejected", or "fulfilled").
46 *
47 * The three states can be checked against the constants defined on
48 * PromiseInterface: PENDING, FULFILLED, and REJECTED.
49 */
50 public function getState(): string;
51
52 /**
53 * Resolve the promise with the given value.
54 *
55 * @param mixed $value
56 *
57 * @throws \RuntimeException if the promise is already resolved.
58 */
59 public function resolve($value): void;
60
61 /**
62 * Reject the promise with the given reason.
63 *
64 * @param mixed $reason
65 *
66 * @throws \RuntimeException if the promise is already resolved.
67 */
68 public function reject($reason): void;
69
70 /**
71 * Cancels the promise if possible.
72 *
73 * @see https://github.com/promises-aplus/cancellation-spec/issues/7
74 */
75 public function cancel(): void;
76
77 /**
78 * Waits until the promise completes if possible.
79 *
80 * Pass $unwrap as true to unwrap the result of the promise, either
81 * returning the resolved value or throwing the rejected exception.
82 *
83 * If the promise cannot be waited on, then the promise will be rejected.
84 *
85 * @return mixed
86 *
87 * @throws \LogicException if the promise has no wait function or if the
88 * promise does not settle after waiting.
89 */
90 public function wait(bool $unwrap = true);
91 }
92