| @@ 57-74 (lines=18) @@ | ||
| 54 | * |
|
| 55 | * @return self |
|
| 56 | */ |
|
| 57 | public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null) |
|
| 58 | { |
|
| 59 | $this->adaptee->then(function () use ($onFulfilled) { |
|
| 60 | if ($onFulfilled !== null) { |
|
| 61 | return call_user_func_array($onFulfilled, func_get_args()); |
|
| 62 | } |
|
| 63 | }, function () use ($onRejected) { |
|
| 64 | if ($onRejected !== null) { |
|
| 65 | return call_user_func_array($onRejected, func_get_args()); |
|
| 66 | } |
|
| 67 | }, function () use ($onProgress) { |
|
| 68 | if ($onProgress !== null) { |
|
| 69 | return call_user_func_array($onProgress, func_get_args()); |
|
| 70 | } |
|
| 71 | }); |
|
| 72 | ||
| 73 | return $this; |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @param callable|null $onFulfilled |
|
| @@ 83-100 (lines=18) @@ | ||
| 80 | * |
|
| 81 | * @return self |
|
| 82 | */ |
|
| 83 | public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null) |
|
| 84 | { |
|
| 85 | $this->adaptee->done(function () use ($onFulfilled) { |
|
| 86 | if ($onFulfilled !== null) { |
|
| 87 | return call_user_func_array($onFulfilled, func_get_args()); |
|
| 88 | } |
|
| 89 | }, function () use ($onRejected) { |
|
| 90 | if ($onRejected !== null) { |
|
| 91 | return call_user_func_array($onRejected, func_get_args()); |
|
| 92 | } |
|
| 93 | }, function () use ($onProgress) { |
|
| 94 | if ($onProgress !== null) { |
|
| 95 | return call_user_func_array($onProgress, func_get_args()); |
|
| 96 | } |
|
| 97 | }); |
|
| 98 | ||
| 99 | return $this; |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * @param callable $onRejected |
|