@@ 27-41 (lines=15) @@ | ||
24 | $this->value = $value; |
|
25 | } |
|
26 | ||
27 | public function then( |
|
28 | callable $onFulfilled = null, |
|
29 | callable $onRejected = null, |
|
30 | callable $onProgress = null |
|
31 | ) : PromiseInterface { |
|
32 | if (null === $onFulfilled) { |
|
33 | return $this; |
|
34 | } |
|
35 | ||
36 | try { |
|
37 | return resolve($onFulfilled($this->value)); |
|
38 | } catch (\Exception $exception) { |
|
39 | return new RejectedPromise($exception); |
|
40 | } |
|
41 | } |
|
42 | ||
43 | public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null) |
|
44 | { |
@@ 29-43 (lines=15) @@ | ||
26 | $this->reason = $reason; |
|
27 | } |
|
28 | ||
29 | public function then( |
|
30 | callable $onFulfilled = null, |
|
31 | callable $onRejected = null, |
|
32 | callable $onProgress = null |
|
33 | ) : PromiseInterface { |
|
34 | if (null === $onRejected) { |
|
35 | return $this; |
|
36 | } |
|
37 | ||
38 | try { |
|
39 | return resolve($onRejected($this->reason)); |
|
40 | } catch (\Exception $exception) { |
|
41 | return new RejectedPromise($exception); |
|
42 | } |
|
43 | } |
|
44 | ||
45 | public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null) |
|
46 | { |