PluginProbe
Media Cloud Sync / 1.0.3
Media Cloud Sync v1.0.3
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
media-cloud-sync / includes / sdk / s3 / GuzzleHttp / Promise / PromiseInterface.php

PromiseInterface.php in Media Cloud Sync 1.0.3, at includes/sdk/s3/GuzzleHttp/Promise/PromiseInterface.php

88 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\GuzzleHttp\Promise;
4
5 /**
6 * A promise represents the eventual result of an asynchronous operation.
7 *
8 * The primary way of interacting with a promise is through its then method,
9 * which registers callbacks to receive either a promise’s eventual value or
10 * the reason why the promise cannot be fulfilled.
11 *
12 * @link https://promisesaplus.com/
13 */
14 interface PromiseInterface
15 {
16 const PENDING = 'pending';
17 const FULFILLED = 'fulfilled';
18 const REJECTED = 'rejected';
19 /**
20 * Appends fulfillment and rejection handlers to the promise, and returns
21 * a new promise resolving to the return value of the called handler.
22 *
23 * @param callable $onFulfilled Invoked when the promise fulfills.
24 * @param callable $onRejected Invoked when the promise is rejected.
25 *
26 * @return PromiseInterface
27 */
28 public function then(callable $onFulfilled = null, callable $onRejected = null);
29 /**
30 * Appends a rejection handler callback to the promise, and returns a new
31 * promise resolving to the return value of the callback if it is called,
32 * or to its original fulfillment value if the promise is instead
33 * fulfilled.
34 *
35 * @param callable $onRejected Invoked when the promise is rejected.
36 *
37 * @return PromiseInterface
38 */
39 public function otherwise(callable $onRejected);
40 /**
41 * Get the state of the promise ("pending", "rejected", or "fulfilled").
42 *
43 * The three states can be checked against the constants defined on
44 * PromiseInterface: PENDING, FULFILLED, and REJECTED.
45 *
46 * @return string
47 */
48 public function getState();
49 /**
50 * Resolve the promise with the given value.
51 *
52 * @param mixed $value
53 *
54 * @throws \RuntimeException if the promise is already resolved.
55 */
56 public function resolve($value);
57 /**
58 * Reject the promise with the given reason.
59 *
60 * @param mixed $reason
61 *
62 * @throws \RuntimeException if the promise is already resolved.
63 */
64 public function reject($reason);
65 /**
66 * Cancels the promise if possible.
67 *
68 * @link https://github.com/promises-aplus/cancellation-spec/issues/7
69 */
70 public function cancel();
71 /**
72 * Waits until the promise completes if possible.
73 *
74 * Pass $unwrap as true to unwrap the result of the promise, either
75 * returning the resolved value or throwing the rejected exception.
76 *
77 * If the promise cannot be waited on, then the promise will be rejected.
78 *
79 * @param bool $unwrap
80 *
81 * @return mixed
82 *
83 * @throws \LogicException if the promise has no wait function or if the
84 * promise does not settle after waiting.
85 */
86 public function wait($unwrap = \true);
87 }
88