Пример #1
0
 /**
  *  Expand the given url
  *
  *  @param  string $url
  *  @throws \Guzzle\Http\Exception\BadResponseException
  *  @throws \Mremi\UrlShortener\Exception\InvalidApiResponseException
  *  @return string
  */
 public function expand($url)
 {
     $link = new Link();
     $link->setShortUrl($url);
     $this->provider->expand($link);
     return $link->getLongUrl();
 }
Пример #2
0
 /**
  * Return the content of the Site Map
  */
 public function shortenUrl($url)
 {
     $link = new Link();
     $link->setLongUrl($url);
     $googleProvider = new GoogleProvider(env('SHORT_URL_API'), array('connect_timeout' => 1, 'timeout' => 1));
     $googleProvider->shorten($link);
     return $link;
 }
Пример #3
0
 protected function getProviderLink()
 {
     $link = new Link();
     $link->setLongUrl($this->original_url);
     $provider = new BitlyProvider(new OAuthClient(config('petty.username'), config('petty.password')), array());
     $provider->shorten($link);
     return $link->getShortUrl();
 }
Пример #4
0
 /**
  * Return the content of the Site Map
  */
 public function shortenUrl($url)
 {
     $link = new Link();
     $link->setLongUrl($url);
     $googleProvider = new GoogleProvider('AIzaSyD6K3mZLFLxYtvpXl_F3L4xTF6H7lO7BZg', array('connect_timeout' => 1, 'timeout' => 1));
     $googleProvider->shorten($link);
     //			dd($link);
     return $link;
 }
 /**
  * Tests the createdAt property
  */
 public function testCreatedAt()
 {
     $link = new Link();
     $this->assertInstanceOf('\\DateTime', $link->getCreatedAt());
 }