isResolved) { throw new \LogicException( 'Cannot update resolved promise' ); } foreach ($this->watchers as $watcher) { call_user_func($watcher[0], $progress, $watcher[1]); } } /** * Resolve the promised value as a success * * @param mixed $result * @return void */ public function succeed($result = null) { $this->resolve($error = null, $result); } /** * Resolve the promised value as a failure * * @param \Exception $error * @return void */ public function fail(\Exception $error) { $this->resolve($error, $result = null); } }