PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / trunk
Booking for Appointments and Events Calendar – Amelia vtrunk
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / php-http / promise / src / Promise.php
ameliabooking / vendor / php-http / promise / src Last commit date
FulfilledPromise.php 3 years ago Promise.php 3 years ago RejectedPromise.php 3 years ago
Promise.php
70 lines
1 <?php
2
3 namespace AmeliaHttp\Promise;
4
5 /**
6 * Promise represents a value that may not be available yet, but will be resolved at some point in future.
7 * It acts like a proxy to the actual value.
8 *
9 * This interface is an extension of the promises/a+ specification.
10 *
11 * @see https://promisesaplus.com/
12 *
13 * @author Joel Wurtz <joel.wurtz@gmail.com>
14 * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
15 */
16 interface Promise
17 {
18 /**
19 * Promise has not been fulfilled or rejected.
20 */
21 const PENDING = 'pending';
22
23 /**
24 * Promise has been fulfilled.
25 */
26 const FULFILLED = 'fulfilled';
27
28 /**
29 * Promise has been rejected.
30 */
31 const REJECTED = 'rejected';
32
33 /**
34 * Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
35 *
36 * If you do not care about one of the cases, you can set the corresponding callable to null
37 * The callback will be called when the value arrived and never more than once.
38 *
39 * @param callable $onFulfilled Called when a response will be available.
40 * @param callable $onRejected Called when an exception occurs.
41 *
42 * @return Promise A new resolved promise with value of the executed callback (onFulfilled / onRejected).
43 */
44 public function then(callable $onFulfilled = null, callable $onRejected = null);
45
46 /**
47 * Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
48 *
49 * @return string
50 */
51 public function getState();
52
53 /**
54 * Wait for the promise to be fulfilled or rejected.
55 *
56 * When this method returns, the request has been resolved and if callables have been
57 * specified, the appropriate one has terminated.
58 *
59 * When $unwrap is true (the default), the response is returned, or the exception thrown
60 * on failure. Otherwise, nothing is returned or thrown.
61 *
62 * @param bool $unwrap Whether to return resolved value / throw reason or not
63 *
64 * @return mixed Resolved value, null if $unwrap is set to false
65 *
66 * @throws \Exception The rejection reason if $unwrap is set to true and the request failed.
67 */
68 public function wait($unwrap = true);
69 }
70