API Documentation

Gdata/App.php

Includes Functions Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Gdata
subpackage
App
version
$Id: App.php 22515 2010-07-03 19:11:00Z rboyd $
Functions
retrieveAllEntriesForFeed
enableRequestDebugLogging
getNextFeed
getPreviousFeed
generateIfMatchHeaderData
usingObjectMapping
useObjectMapping
Classes
Zend_Gdata_App

Description

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 license@zend.com so we can send you a copy immediately.

Functions

enableRequestDebugLogging

enableRequestDebugLogging( $logfile $logfile ) :

This method enables logging of requests by changing the Zend_Http_Client_Adapter used for performing the requests.

NOTE: This will not work if you have customized the adapter already to use a proxy server or other interface.

Arguments

$logfile
$logfile
The logfile to use when logging the requests

generateIfMatchHeaderData

generateIfMatchHeaderData(  $data,  $allowWeek ) : string|null

Returns the data for an If-Match header based on the current Etag property. If Etags are not supported by the server or cannot be extracted from the data, then null will be returned.

Arguments

$data
$allowWeek

Output

string|null
$data

getNextFeed

getNextFeed( Zend_Gdata_App_Feed $feed, string $className = null ) : Zend_Gdata_App_Feed|null

Retrieve next set of results based on a given feed.

Arguments

$feed
Zend_Gdata_App_Feed
The feed from which to retreive the next set of results.
$className
string
(optional) The class of feed to be returned. If null, the next feed (if found) will be the same class as the feed that was given as the first argument.

Output

Zend_Gdata_App_Feed|null
Returns a Zend_Gdata_App_Feed or null if no next set of results exists.

getPreviousFeed

getPreviousFeed( Zend_Gdata_App_Feed $feed, string $className = null ) : Zend_Gdata_App_Feed|null

Retrieve previous set of results based on a given feed.

Arguments

$feed
Zend_Gdata_App_Feed
The feed from which to retreive the previous set of results.
$className
string
(optional) The class of feed to be returned. If null, the previous feed (if found) will be the same class as the feed that was given as the first argument.

Output

Zend_Gdata_App_Feed|null
Returns a Zend_Gdata_App_Feed or null if no previous set of results exists.

retrieveAllEntriesForFeed

retrieveAllEntriesForFeed( $feed $feed ) : mixed

Retrieve all entries for a feed, iterating through pages as necessary.

Be aware that calling this function on a large dataset will take a significant amount of time to complete. In some cases this may cause execution to timeout without proper precautions in place.

Arguments

$feed
$feed
The feed to iterate through.

Output

mixed
A new feed of the same type as the one originally passed in, containing all relevent entries.

useObjectMapping

useObjectMapping( boolean $value ) : void

Enable/disable the use of XML to object mapping.

Arguments

$value
boolean
Pass in true to use the XML to object mapping. Pass in false or null to disable it.

usingObjectMapping

usingObjectMapping( ) : boolean

Determine whether service object is using XML to object mapping.

Output

boolean
True if service object is using XML to object mapping, false otherwise.

Zend_Gdata_App

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Gdata
subpackage
App
Constants
DEFAULT_MAJOR_PROTOCOL_VERSION
DEFAULT_MINOR_PROTOCOL_VERSION
Properties
$_httpClient
$_staticHttpClient
$_httpMethodOverride
$_gzipEnabled
$_verboseExceptionMessages
$_defaultPostUri
$_registeredPackages
$_maxRedirects
$_majorProtocolVersion
$_minorProtocolVersion
$_useObjectMapping
Methods
__construct
registerPackage
getFeed
getEntry
getHttpClient
setHttpClient
setStaticHttpClient
getStaticHttpClient
setHttpMethodOverride
getHttpMethodOverride
setGzipEnabled
getGzipEnabled
getVerboseExceptionMessages
setVerboseExceptionMessages
setMaxRedirects
getMaxRedirects
setMajorProtocolVersion
getMajorProtocolVersion
setMinorProtocolVersion
getMinorProtocolVersion
prepareRequest
performHttpRequest
import
importUrl
importString
importFile
get
post
put
delete
insertEntry
updateEntry
__call

Description

Provides Atom Publishing Protocol (APP) functionality. This class and all other components of Zend_Gdata_App are designed to work independently from other Zend_Gdata components in order to interact with generic APP services.

Constants

DEFAULT_MAJOR_PROTOCOL_VERSION

 DEFAULT_MAJOR_PROTOCOL_VERSION = '1'

Default major protocol version.

Details

value
1
see
_majorProtocolVersion

DEFAULT_MINOR_PROTOCOL_VERSION

 DEFAULT_MINOR_PROTOCOL_VERSION = 'null'

Default minor protocol version.

Details

value
null
see
_minorProtocolVersion

Properties

$_defaultPostUri

string $_defaultPostUri = 'null'

Default URI to which to POST.

Details

$_defaultPostUri
string
visibility
protected
default
null
final
false
static
false

$_gzipEnabled

boolean $_gzipEnabled = 'false'

Enable gzipped responses?

Details

$_gzipEnabled
boolean
visibility
protected
default
false
final
false
static
true

$_httpClient

Zend_Http_Client $_httpClient = ''

Client object used to communicate

Details

$_httpClient
Zend_Http_Client
visibility
protected
default
final
false
static
false

$_httpMethodOverride

boolean $_httpMethodOverride = 'false'

Override HTTP PUT and DELETE request methods?

Details

$_httpMethodOverride
boolean
visibility
protected
default
false
final
false
static
true

$_majorProtocolVersion

 $_majorProtocolVersion = ''

Indicates the major protocol version that should be used.

At present, recognized values are either 1 or 2. However, any integer value >= 1 is considered valid.

Under most circumtances, this will be automatically set by Zend_Gdata_App subclasses.

Details

visibility
protected
default
final
false
static
false
see
setMajorProtocolVersion()
see
getMajorProtocolVersion()

$_maxRedirects

int $_maxRedirects = '5'

Maximum number of redirects to follow during HTTP operations

Details

$_maxRedirects
int
visibility
protected
default
5
final
false
static
true

$_minorProtocolVersion

 $_minorProtocolVersion = ''

Indicates the minor protocol version that should be used. Can be set to either an integer >= 0, or NULL if no minor version should be sent to the server.

At present, this field is not used by any Google services, but may be used in the future.

Under most circumtances, this will be automatically set by Zend_Gdata_App subclasses.

Details

visibility
protected
default
final
false
static
false
see
setMinorProtocolVersion()
see
getMinorProtocolVersion()

$_registeredPackages

array $_registeredPackages = 'array'

Packages to search for classes when using magic __call method, in order.

Details

$_registeredPackages
array
visibility
protected
default
array
final
false
static
false

$_staticHttpClient

Zend_Http_Client $_staticHttpClient = 'null'

Client object used to communicate in static context

Details

$_staticHttpClient
Zend_Http_Client
visibility
protected
default
null
final
false
static
true

$_useObjectMapping

boolean $_useObjectMapping = 'true'

Whether we want to use XML to object mapping when fetching data.

Details

$_useObjectMapping
boolean
visibility
protected
default
true
final
false
static
false

$_verboseExceptionMessages

boolean $_verboseExceptionMessages = 'true'

Use verbose exception messages. In the case of HTTP errors, use the body of the HTTP response in the exception message.

Details

$_verboseExceptionMessages
boolean
visibility
protected
default
true
final
false
static
true

Methods

__call

__call( string $method, array $args ) :

Provides a magic factory method to instantiate new objects with shorter syntax than would otherwise be required by the Zend Framework naming conventions. For instance, to construct a new Zend_Gdata_Calendar_Extension_Color, a developer simply needs to do $gCal->newColor(). For this magic constructor, packages are searched in the same order as which they appear in the $_registeredPackages array

Arguments
$method
string
The method name being called
$args
array
The arguments passed to the call
Details
visibility
public
final
false
static
false
throws

__construct

__construct( Zend_Http_Client $client = null, string $applicationId = MyCompany-MyApp-1.0 ) :

Create Gdata object

Arguments
$client
Zend_Http_Client
$applicationId
string
Details
visibility
public
final
false
static
false

delete

delete( mixed $data,  $remainingRedirects = null ) : void

DELETE entry with client object

Arguments
$data
mixed
The Zend_Gdata_App_Entry or URL to delete
$remainingRedirects
Details
visibility
public
final
false
static
false
throws
throws
throws

get

get( string $uri, array $extraHeaders = array ) : Zend_Http_Response

GET a URI using client object.

Arguments
$uri
string
GET URI
$extraHeaders
array
Extra headers to add to the request, as an array of string-based key/value pairs.
Details
visibility
public
final
false
static
false
throws

getEntry

getEntry( string $uri, string $className = Zend_Gdata_App_Entry ) : string|Zend_Gdata_App_Entry

Retrieve entry as string or object

Arguments
$uri
string
$className
string
The class which is used as the return type
Output
string|Zend_Gdata_App_Entry
Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function.
Details
visibility
public
final
false
static
false

getFeed

getFeed( string $uri, string $className = Zend_Gdata_App_Feed ) : string|Zend_Gdata_App_Feed

Retrieve feed as string or object

Arguments
$uri
string
The uri from which to retrieve the feed
$className
string
The class which is used as the return type
Output
string|Zend_Gdata_App_Feed
Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function.
Details
visibility
public
final
false
static
false

getGzipEnabled

getGzipEnabled( ) : boolean

Get the HTTP override state

Output
boolean
Details
visibility
public
final
false
static
true

getHttpClient

getHttpClient( ) : Zend_Http_Client

Get the Zend_Http_Client object used for communication

Details
visibility
public
final
false
static
false

getHttpMethodOverride

getHttpMethodOverride( ) : boolean

Get the HTTP override state

Output
boolean
Details
visibility
public
final
false
static
true

getMajorProtocolVersion

getMajorProtocolVersion( ) : int

Get the major protocol version that is in use.

Output
int
The major protocol version in use.
Details
visibility
public
final
false
static
false
see
_majorProtocolVersion

getMaxRedirects

getMaxRedirects( ) : int

Get the maximum number of redirects to follow during HTTP operations

Output
int
Maximum number of redirects to follow
Details
visibility
public
final
false
static
true

getMinorProtocolVersion

getMinorProtocolVersion( ) : (int|NULL)

Get the minor protocol version that is in use.

Output
(int|NULL)
The major protocol version in use, or NULL if no minor version is specified.
Details
visibility
public
final
false
static
false
see
_minorProtocolVersion

getStaticHttpClient

getStaticHttpClient( ) : Zend_Http_Client

Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used.

Details
visibility
public
final
false
static
true

getVerboseExceptionMessages

getVerboseExceptionMessages( ) : boolean

Get whether to use verbose exception messages

In the case of HTTP errors, use the body of the HTTP response in the exception message.

Output
boolean
Details
visibility
public
final
false
static
true

import

import( string $uri, Zend_Http_Client $client = null, string $className = Zend_Gdata_App_Feed ) : string|Zend_Gdata_App_Feed

Imports a feed located at $uri.

Arguments
$uri
string
$client
Zend_Http_Client
The client used for communication
$className
string
The class which is used as the return type
Output
string|Zend_Gdata_App_Feed
Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function.
Details
visibility
public
final
false
static
true
throws

importFile

importFile( string $filename, string $className = Zend_Gdata_App_Feed, string $useIncludePath = false ) : Zend_Gdata_App_Feed

Imports a feed from a file located at $filename.

Arguments
$filename
string
$className
string
The class which is used as the return type
$useIncludePath
string
Whether the include_path should be searched
Details
visibility
public
final
false
static
true
throws

importString

importString( string $string, string $className = Zend_Gdata_App_Feed,  $majorProtocolVersion = null,  $minorProtocolVersion = null ) : Zend_Gdata_App_Feed

Imports a feed represented by $string.

Arguments
$string
string
$className
string
The class which is used as the return type
$majorProtocolVersion
$minorProtocolVersion
Details
visibility
public
final
false
static
true
throws

importUrl

importUrl( string $url, string $className = Zend_Gdata_App_Feed, array $extraHeaders = array ) : string|Zend_Gdata_App_Feed

Imports the specified URL (non-statically).

Arguments
$url
string
The URL to import
$className
string
The class which is used as the return type
$extraHeaders
array
Extra headers to add to the request, as an array of string-based key/value pairs.
Output
string|Zend_Gdata_App_Feed
Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function.
Details
visibility
public
final
false
static
false
throws

insertEntry

insertEntry( mixed $data, string $uri, string $className = Zend_Gdata_App_Entry, array $extraHeaders = array ) : Zend_Gdata_App_Entry

Inserts an entry to a given URI and returns the response as a fully formed Entry.

Arguments
$data
mixed
The Zend_Gdata_App_Entry or XML to post
$uri
string
POST URI
$className
string
The class of entry to be returned.
$extraHeaders
array
Extra headers to add to the request, as an array of string-based key/value pairs.
Output
Zend_Gdata_App_Entry
The entry returned by the service after insertion.
Details
visibility
public
final
false
static
false

performHttpRequest

performHttpRequest( string $method, string $url, array $headers = null, string $body = null, string $contentType = null, int $remainingRedirects = null ) : Zend_Http_Response

Performs a HTTP request using the specified method

Arguments
$method
string
The HTTP method for the request - 'GET', 'POST', 'PUT', 'DELETE'
$url
string
The URL to which this request is being performed
$headers
array
An associative array of HTTP headers for this request
$body
string
The body of the HTTP request
$contentType
string
The value for the content type of the request body
$remainingRedirects
int
Number of redirects to follow if request s results in one
Output
Zend_Http_Response
The response object
Details
visibility
public
final
false
static
false

post

post( mixed $data, string $uri = null,  $remainingRedirects = null, string $contentType = null, array $extraHeaders = null ) : Zend_Http_Response

POST data with client object

Arguments
$data
mixed
The Zend_Gdata_App_Entry or XML to post
$uri
string
POST URI
$remainingRedirects
$contentType
string
Content-type of the data
$extraHeaders
array
Extra headers to add to the request, as an array of string-based key/value pairs.
Details
visibility
public
final
false
static
false
throws
throws
throws

prepareRequest

prepareRequest( string $method, string $url = null, array $headers = array, mixed $data = null, string $contentTypeOverride = null ) : array

Provides pre-processing for HTTP requests to APP services.

  1. Checks the $data element and, if it's an entry, extracts the XML, multipart data, edit link (PUT,DELETE), etc.
  2. If $data is a string, sets the default content-type header as 'application/atom+xml' if it's not already been set.
  3. Adds a x-http-method override header and changes the HTTP method to 'POST' if necessary as per getHttpMethodOverride()
Arguments
$method
string
The HTTP method for the request - 'GET', 'POST', 'PUT', 'DELETE'
$url
string
The URL to which this request is being performed, or null if found in $data
$headers
array
An associative array of HTTP headers for this request
$data
mixed
The Zend_Gdata_App_Entry or XML for the body of the request
$contentTypeOverride
string
The override value for the content type of the request body
Output
array
An associative array containing the determined 'method', 'url', 'data', 'headers', 'contentType'
Details
visibility
public
final
false
static
false

put

put( mixed $data, string $uri = null,  $remainingRedirects = null, string $contentType = null, array $extraHeaders = null ) : Zend_Http_Response

PUT data with client object

Arguments
$data
mixed
The Zend_Gdata_App_Entry or XML to post
$uri
string
PUT URI
$remainingRedirects
$contentType
string
Content-type of the data
$extraHeaders
array
Extra headers to add to the request, as an array of string-based key/value pairs.
Details
visibility
public
final
false
static
false
throws
throws
throws

registerPackage

registerPackage( string $name ) : void

Adds a Zend Framework package to the $_registeredPackages array.

This array is searched when using the magic __call method below to instantiante new objects.

Arguments
$name
string
The name of the package (eg Zend_Gdata_App)
Details
visibility
public
final
false
static
false

setGzipEnabled

setGzipEnabled( boolean $enabled = false ) : void

Toggle requesting gzip encoded responses

Arguments
$enabled
boolean
Whether or not to enable gzipped responses
Details
visibility
public
final
false
static
true

setHttpClient

setHttpClient( Zend_Http_Client $client,  $applicationId = MyCompany-MyApp-1.0 ) : Zend_Gdata_App

Set the Zend_Http_Client object used for communication

Arguments
$client
Zend_Http_Client
The client to use for communication
$applicationId
Output
Zend_Gdata_App
Provides a fluent interface
Details
visibility
public
final
false
static
false
throws

setHttpMethodOverride

setHttpMethodOverride( boolean $override = true ) : void

Toggle using POST instead of PUT and DELETE HTTP methods

Some feed implementations do not accept PUT and DELETE HTTP methods, or they can't be used because of proxies or other measures. This allows turning on using POST where PUT and DELETE would normally be used; in addition, an X-Method-Override header will be sent with a value of PUT or DELETE as appropriate.

Arguments
$override
boolean
Whether to override PUT and DELETE with POST.
Details
visibility
public
final
false
static
true

setMajorProtocolVersion

setMajorProtocolVersion( int $value ) :

Set the major protocol version that should be used. Values < 1 will cause a Zend_Gdata_App_InvalidArgumentException to be thrown.

Arguments
$value
int
The major protocol version to use.
Details
visibility
public
final
false
static
false
see
_majorProtocolVersion
throws

setMaxRedirects

setMaxRedirects( int $maxRedirects ) : void

Set the maximum number of redirects to follow during HTTP operations

Arguments
$maxRedirects
int
Maximum number of redirects to follow
Details
visibility
public
final
false
static
true

setMinorProtocolVersion

setMinorProtocolVersion( (int|NULL) $value ) :

Set the minor protocol version that should be used. If set to NULL, no minor protocol version will be sent to the server. Values < 0 will cause a Zend_Gdata_App_InvalidArgumentException to be thrown.

Arguments
$value
(intNULL)
The minor protocol version to use.
Details
visibility
public
final
false
static
false
see
_minorProtocolVersion
throws

setStaticHttpClient

setStaticHttpClient( Zend_Http_Client $httpClient ) : void

Set the static HTTP client instance

Sets the static HTTP client object to use for retrieving the feed.

Arguments
$httpClient
Zend_Http_Client
Details
visibility
public
final
false
static
true

setVerboseExceptionMessages

setVerboseExceptionMessages( boolean $verbose ) :

Set whether to use verbose exception messages

In the case of HTTP errors, use the body of the HTTP response in the exception message.

Arguments
$verbose
boolean
Whether to use verbose exception messages
Details
visibility
public
final
false
static
true

updateEntry

updateEntry( mixed $data, string|null $uri = null, string|null $className = null, array $extraHeaders = array ) : Zend_Gdata_App_Entry

Update an entry

Arguments
$data
mixed
Zend_Gdata_App_Entry or XML (w/ID and link rel=&#039;edit&#039;)
$uri
stringnull
The URI to send requests to, or null if $data contains the URI.
$className
stringnull
The name of the class that should be deserialized from the server response. If null, then &#039;Zend_Gdata_App_Entry&#039; will be used.
$extraHeaders
array
Extra headers to add to the request, as an array of string-based key/value pairs.
Output
Zend_Gdata_App_Entry
The entry returned from the server
Details
visibility
public
final
false
static
false
throws
Documentation was generated by DocBlox.