1 | <?php |
||
12 | class AllocationPromise implements PromiseInterface |
||
13 | { |
||
14 | private $promise; |
||
15 | private $resolver; |
||
16 | private $result; |
||
17 | |||
18 | public function __construct(PromiseInterface $promise, $resolver = null) |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | public function then(callable $fulfilledHandler = null, callable $errorHandler = null, callable $progressHandler = null) |
||
31 | |||
32 | /** |
||
33 | * Calls the specified handler when this promise is fulfilled. |
||
34 | * |
||
35 | * If the handler returns a promise, |
||
36 | * |
||
37 | * @param callable $handler |
||
38 | * @return PromiseInterface |
||
39 | */ |
||
40 | public function to($handler /*, $args… */) |
||
59 | |||
60 | /** |
||
61 | * Tries to return the allocation now, synchronously |
||
62 | * |
||
63 | * If the pool does not have sufficient resources available then an exception is thrown and this |
||
64 | * promise is rejected |
||
65 | * |
||
66 | * @return Allocation |
||
67 | * @throws \RuntimeException thrown if the allocation fails or has previously failed |
||
68 | */ |
||
69 | public function now() |
||
73 | |||
74 | protected function getResult($burst) |
||
86 | |||
87 | private function resolve($burst) |
||
106 | } |
||
107 |