/** * Merge a base URI and a relative URI into a new URI object * * This convenience method wraps ::resolve() to allow users to quickly * create new absolute URLs without the need to instantiate and clone * URI objects. * * If objects are passed in, none of the passed objects will be modified. * * @param Uri|string $baseUri * @param Uri|string $relativeUri * @return Uri */ public static function merge($baseUri, $relativeUri) { $uri = new self($relativeUri); return $uri->resolve($baseUri); }
/** * {@inheritdoc} */ public function delay(float $time) : Awaitable { if (null !== $this->result) { return $this->unwrap()->delay($time); } ++$this->children; $future = new self(function (Throwable $exception) use(&$timer) { if (null !== $timer) { $timer->stop(); } if (0 === --$this->children) { $this->cancel($exception); } }); $onFulfilled = function () use(&$timer, $time, $future) { $timer = Loop\timer($time, function () use($future) { $future->resolve($this->result); }); }; $onRejected = function () use($future) { $future->resolve($this->result); }; $this->done($onFulfilled, $onRejected); return $future; }