/** * {@inheritdoc} * * @param LinkInterface $link A link instance * @param string $hash A Bit.ly hash * * @throws InvalidApiResponseException */ public function expand(LinkInterface $link, $hash = null) { $client = $this->createClient(); $request = $client->get(sprintf('/v3/expand?access_token=%s&shortUrl=%s&hash=%s', $this->auth->getAccessToken(), urlencode($link->getShortUrl()), $hash), array(), $this->options); $response = $this->validate($request->send()->getBody(true)); $link->setLongUrl($response->data->expand[0]->long_url); }
/** * {@inheritdoc} */ public function expand(LinkInterface $link) { $client = $this->createClient(); $request = $client->get($this->getUri(array('shortUrl' => $link->getShortUrl())), array(), $this->options); $response = $this->validate($request->send()->getBody(true), true); $link->setLongUrl($response->longUrl); }