コード例 #1
0
ファイル: BaseDriver.php プロジェクト: Waavi/url-shortener
 /**
  *  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
ファイル: ShortenLink.php プロジェクト: themiloagency/drbell
 /**
  * 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
ファイル: Url.php プロジェクト: jgrossi/petty
 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;
 }
コード例 #5
0
 /**
  * Tests the createdAt property
  */
 public function testCreatedAt()
 {
     $link = new Link();
     $this->assertInstanceOf('\\DateTime', $link->getCreatedAt());
 }