Services_ShortURL
[ class tree: Services_ShortURL ] [ index: Services_ShortURL ] [ all elements ]

Class: Services_ShortURL_Common

Source Location: /Services_ShortURL-0.3.1/Services/ShortURL/Common.php

Class Overview


A common class for all short URL drivers


Author(s):

Variables

Methods


Child classes:

Services_ShortURL_TinyURL
Interface for creating/expanding tinyurl.com links
Services_ShortURL_Googl
Interface for creating/expanding goo.gl links
Services_ShortURL_Digg
Interface for creating/expanding Digg links
Services_ShortURL_Bitly
Interface for creating/expanding bit.ly links
Services_ShortURL_Shortie
Interface for creating/expanding short.ie links
Services_ShortURL_Trim
Interface for creating/expanding tr.im links
Services_ShortURL_Isgd
Interface for creating/expanding is.gd links

Inherited Variables

Inherited Methods


Class Details

[line 36]
A common class for all short URL drivers


[ Top ]


Class Variables

$options = array()

[line 49]

Service options

Some services require an API key, username/password, or other non-standard information. Those options are set on a per-service basis and passed to the constructor.


Type:   array


[ Top ]

$req =  null

[line 57]

Instance of HTTP_Request2

Type:   object


[ Top ]



Method Detail

__construct (Constructor)   [line 67]

void __construct( [array $options = array()], [HTTP_Request2 $req = null])

Constructor
  • Access: public

Overridden in child classes as:

Services_ShortURL_Googl::__construct()
Constructor
Services_ShortURL_Digg::__construct()
Constructor
Services_ShortURL_Bitly::__construct()
Constructor

Parameters:

array   $options   —  Service options
object   $req   —  Provide your own HTTP_Request2 instance

[ Top ]

accept   [line 93]

void accept( object $object)

Acceptor pattern

By default, Services_ShortURL will create a cURL version of HTTP_Request2. If you need to override this you can use the accept method or pass an instance into the constructor.

  • Throws: InvalidArgumentException on invalid object
  • Access: public

Parameters:

object   $object   —  Instance of HTTP_Request2

[ Top ]

expand   [line 121]

string expand( string $url)

Default expand method

All of the URL shortening services, for the most part, do a 301 redirect using the Location header. Rather than implement this over and over we provide it here and assume others who need non-normal expansion will override this method.


Overridden in child classes as:

Services_ShortURL_Googl::expand()
Shorten a URL using http://goo.gl
Services_ShortURL_Digg::expand()
Expand a http://digg.com short URL

Parameters:

string   $url   —  The URL to expand

[ Top ]

info   [line 159]

mixed info( string $url)

Fetch information about the short URL

Parameters:

string   $url   —  The short URL to fetch information for

[ Top ]

stats   [line 144]

mixed stats( string $url)

Fetch information about the short URL

Parameters:

string   $url   —  The short URL to fetch information for

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:43:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.