protected function mutate(callable $resolver = null)
{
if ($resolver === null) {
return;
}
try {
$resolver(function ($value = null) {
$this->resolve($value);
}, function ($reason = null) {
$this->reject($reason);
}, function ($reason = null) {
$this->cancel($reason);
});
} catch (Error $ex) {
$this->reject($ex);
} catch (Exception $ex) {
$this->reject($ex);
}
}