public function __construct($computation = NULL)
{
if (is_callable($computation)) {
try {
$this->resolve(call_user_func($computation));
} catch (UncatchableException $e) {
throw $e->getPrevious();
} catch (Exception $e) {
$this->reject($e);
} catch (Throwable $e) {
$this->reject($e);
}
}
}
public function __construct($executor = null) { parent::__construct(); if (is_callable($executor)) { $self = $this; call_user_func($executor, function ($value) use($self) { $self->resolve($value); }, function ($reason) use($self) { $self->reject($reason); }); } }