Service/ShortUrl/BitLy.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Service_ShortUrl  
Version
$Id$  

\Zend_Service_ShortUrl_BitLy

Package: Zend\Service\ShortUrl

Bit.ly API implementation

Parent(s)
\Zend_Service_ShortUrl_AbstractShortener < \Zend_Service_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotectedstring $_apiKey =

user API key or application access token

Details
Type
string
Propertyprotectedstring $_apiUri = 'http://api.bitly.com'

Base URI of the service

Default value'http://api.bitly.com'Details
Type
string
Propertyprotectedstring $_baseUri = null
inherited

Base URI of the service

Inherited from: \Zend_Service_ShortUrl_AbstractShortener::$$_baseUri
Default valuenullDetails
Type
string
Inherited_from
\Zend_Service_ShortUrl_AbstractShortener::$$_baseUri  
Propertyprotected\Zend_Http_Client $_httpClient = null
staticinherited

HTTP Client used to query all web services

Inherited from: \Zend_Service_Abstract::$$_httpClient\Zend_Service_ShortUrl_AbstractShortener::$$_httpClient
Propertyprotectedstring $_loginName =

user login name

Details
Type
string

Methods

methodpublic__construct(string $login, null | string $apiKey = null) : void

Parameters
Name Type Description
$login string

user login name or application access token

$apiKey null | string

user API key

methodprotected_processRequest() : string

handle bit.ly response

Returns
Type Description
string
Throws
Exception Description
\Zend_Service_ShortUrl_Exception
methodprotected_setAccessParameter() : void

prepare http client

methodprotected_validateUri(string $url) : void
inherited

Checks whether URL to be shortened is valid

Inherited from: \Zend_Service_ShortUrl_AbstractShortener::_validateUri()
Parameters
Name Type Description
$url string
Throws
Exception Description
\Zend_Service_ShortUrl_Exception When URL is not valid
methodprotected_verifyBaseUri(string $shortenedUrl) : void
inherited

Verifies that the URL has been shortened by this service

Inherited from: \Zend_Service_ShortUrl_AbstractShortener::_verifyBaseUri()
Parameters
Name Type Description
$shortenedUrl string
Throws
Exception Description
\Zend_Service_ShortUrl_Exception If the URL hasn't been shortened by this service
methodpublicgetHttpClient() : \Zend_Http_Client
staticfinalinherited

Gets the HTTP client object.

Inherited from: \Zend_Service_Abstract::getHttpClient()\Zend_Service_ShortUrl_AbstractShortener::getHttpClient()
Returns
Type Description
\Zend_Http_Client
methodpublicsetApiLogin( $login,  $apiKey) : \Zend_Service_ShortUrl_BitLy

set login credentials

Parameters
Name Type Description
$login
$apiKey
Returns
Type Description
\Zend_Service_ShortUrl_BitLy
methodpublicsetHttpClient(\Zend_Http_Client $httpClient) : void
staticfinalinherited

Sets the HTTP client object to use for retrieving the feeds.

Inherited from: \Zend_Service_Abstract::setHttpClient()\Zend_Service_ShortUrl_AbstractShortener::setHttpClient()

If none is set, the default Zend_Http_Client will be used.

Parameters
Name Type Description
$httpClient \Zend_Http_Client
methodpublicsetOAuthAccessToken( $accessToken) : \Zend_Service_ShortUrl_BitLy

set OAuth credentials

Parameters
Name Type Description
$accessToken
Returns
Type Description
\Zend_Service_ShortUrl_BitLy
methodpublicshorten(string $url) : string

This function shortens long url

Parameters
Name Type Description
$url string

URL to Shorten

Returns
Type Description
string Shortened Url
Throws
Exception Description
\Zend_Service_ShortUrl_Exception if bit.ly reports an error
methodpublicunshorten(string $shortenedUrl) : string

Reveals target for short URL

Parameters
Name Type Description
$shortenedUrl string

URL to reveal target of

Returns
Type Description
string Unshortened Url
Throws
Exception Description
\Zend_Service_ShortUrl_Exception if bit.ly reports an error
Documentation was generated by phpDocumentor 2.0.0a8.