Gdata/App.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Gdata
- Subpackage
- App
- Version
- $Id$
\Zend_Gdata_App
- Children
- \Zend_Gdata
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties
boolean $_httpMethodOverride = false
false
Details- Type
- boolean
int $_maxRedirects = 5
5
Details- Type
- int
$_minorProtocolVersion
array $_registeredPackages = array('Zend_Gdata_App_Extension', 'Zend_Gdata_App')
array('Zend_Gdata_App_Extension', 'Zend_Gdata_App')
Details- Type
- array
\Zend_Http_Client $_staticHttpClient = null
null
Detailsboolean $_useObjectMapping = true
true
Details- Type
- boolean
Methods
__call(string $method, array $args) : void
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
Name | Type | Description |
---|---|---|
$method | string | The method name being called |
$args | array | The arguments passed to the call |
Exception | Description |
---|---|
\Zend_Gdata_App_Exception |
__construct(\Zend_Http_Client $client = null, string $applicationId = 'MyCompany-MyApp-1.0') : void
Create Gdata object
Name | Type | Description |
---|---|---|
$client | \Zend_Http_Client | |
$applicationId | string |
delete(mixed $data, $remainingRedirects = null) : void
DELETE entry with client object
Name | Type | Description |
---|---|---|
$data | mixed | The Zend_Gdata_App_Entry or URL to delete |
$remainingRedirects |
Exception | Description |
---|---|
\Zend_Gdata_App_Exception | |
\Zend_Gdata_App_HttpException | |
\Zend_Gdata_App_InvalidArgumentException |
enableRequestDebugLogging(string $logfile) : void
This method enables logging of requests by changing the Zend_Http_Client_Adapter used for performing the requests.
Name | Type | Description |
---|---|---|
$logfile | string | The logfile to use when logging the requests |
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.
Name | Type | Description |
---|---|---|
$data | ||
$allowWeek |
Type | Description |
---|---|
string | null | $data |
get(string $uri, array $extraHeaders = array()) : \Zend_Http_Response
GET a URI using client object.
Name | Type | Description |
---|---|---|
$uri | string | GET URI |
$extraHeaders | array | Extra headers to add to the request, as an
|
Type | Description |
---|---|
\Zend_Http_Response |
Exception | Description |
---|---|
\Zend_Gdata_App_HttpException |
getEntry(string $uri, string $className = 'Zend_Gdata_App_Entry') : string | \Zend_Gdata_App_Entry
Retrieve entry as string or object
Name | Type | Description |
---|---|---|
$uri | string | |
$className | string | The class which is used as the return type |
Type | Description |
---|---|
string | \Zend_Gdata_App_Entry | Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function. |
getFeed(string $uri, string $className = 'Zend_Gdata_App_Feed') : string | \Zend_Gdata_App_Feed
Retrieve feed as string or object
Name | Type | Description |
---|---|---|
$uri | string | The uri from which to retrieve the feed |
$className | string | The class which is used as the return type |
Type | Description |
---|---|
string | \Zend_Gdata_App_Feed | Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function. |
getHttpClient() : \Zend_Http_Client
Get the Zend_Http_Client object used for communication
Type | Description |
---|---|
\Zend_Http_Client |
getMaxRedirects() : int
Get the maximum number of redirects to follow during HTTP operations
Type | Description |
---|---|
int | Maximum number of redirects to follow |
getNextFeed(\Zend_Gdata_App_Feed $feed, string $className = null) : \Zend_Gdata_App_Feed | null
Retrieve next set of results based on a given feed.
Name | Type | Description |
---|---|---|
$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.
|
Type | Description |
---|---|
\Zend_Gdata_App_Feed | null | Returns a Zend_Gdata_App_Feed or null if no next set of results exists. |
getPreviousFeed(\Zend_Gdata_App_Feed $feed, string $className = null) : \Zend_Gdata_App_Feed | null
Retrieve previous set of results based on a given feed.
Name | Type | Description |
---|---|---|
$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.
|
Type | Description |
---|---|
\Zend_Gdata_App_Feed | null | Returns a Zend_Gdata_App_Feed or null if no previous set of results exists. |
getStaticHttpClient() : \Zend_Http_Client
Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used.
Type | Description |
---|---|
\Zend_Http_Client |
getVerboseExceptionMessages() : boolean
Get whether to use verbose exception messages
Type | Description |
---|---|
boolean |
import(string $uri, \Zend_Http_Client $client = null, string $className = 'Zend_Gdata_App_Feed', bool $useObjectMapping = true) : string | \Zend_Gdata_App_Feed
Imports a feed located at $uri.
Name | Type | Description |
---|---|---|
$uri | string | |
$client | \Zend_Http_Client | The client used for communication |
$className | string | The class which is used as the return type |
$useObjectMapping | bool | Enable/disable the use of XML to object mapping. |
Type | Description |
---|---|
string | \Zend_Gdata_App_Feed | Returns string only if the fourth parameter ($useObjectMapping) is set to false. |
Exception | Description |
---|---|
\Zend_Gdata_App_Exception |
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.
Name | Type | Description |
---|---|---|
$filename | string | |
$className | string | The class which is used as the return type |
$useIncludePath | string | Whether the include_path should be searched |
Type | Description |
---|---|
\Zend_Gdata_App_Feed |
Exception | Description |
---|---|
\Zend_Gdata_App_Exception |
importString(string $string, string $className = 'Zend_Gdata_App_Feed', $majorProtocolVersion = null, $minorProtocolVersion = null) : \Zend_Gdata_App_Feed
Imports a feed represented by $string.
Name | Type | Description |
---|---|---|
$string | string | |
$className | string | The class which is used as the return type |
$majorProtocolVersion | ||
$minorProtocolVersion |
Type | Description |
---|---|
\Zend_Gdata_App_Feed |
Exception | Description |
---|---|
\Zend_Gdata_App_Exception |
importUrl(string $url, string $className = 'Zend_Gdata_App_Feed', array $extraHeaders = array()) : string | \Zend_Gdata_App_Feed
Imports the specified URL (non-statically).
Name | Type | Description |
---|---|---|
$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
|
Type | Description |
---|---|
string | \Zend_Gdata_App_Feed | Returns string only if the object mapping has been disabled explicitly by passing false to the useObjectMapping() function. |
Exception | Description |
---|---|
\Zend_Gdata_App_Exception |
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.
Name | Type | Description |
---|---|---|
$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
|
Type | Description |
---|---|
\Zend_Gdata_App_Entry | The entry returned by the service after insertion. |
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
Name | Type | Description |
---|---|---|
$method | string | The HTTP method for the request - 'GET', 'POST',
|
$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 |
Type | Description |
---|---|
\Zend_Http_Response | The response object |
post(mixed $data, string $uri = null, $remainingRedirects = null, string $contentType = null, array $extraHeaders = null) : \Zend_Http_Response
POST data with client object
Name | Type | Description |
---|---|---|
$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
|
Type | Description |
---|---|
\Zend_Http_Response |
Exception | Description |
---|---|
\Zend_Gdata_App_Exception | |
\Zend_Gdata_App_HttpException | |
\Zend_Gdata_App_InvalidArgumentException |
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.
Name | Type | Description |
---|---|---|
$method | string | The HTTP method for the request - 'GET', 'POST',
|
$url | string | The URL to which this request is being performed,
|
$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 |
Type | Description |
---|---|
array | An associative array containing the determined 'method', 'url', 'data', 'headers', 'contentType' |
put(mixed $data, string $uri = null, $remainingRedirects = null, string $contentType = null, array $extraHeaders = null) : \Zend_Http_Response
PUT data with client object
Name | Type | Description |
---|---|---|
$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
|
Type | Description |
---|---|
\Zend_Http_Response |
Exception | Description |
---|---|
\Zend_Gdata_App_Exception | |
\Zend_Gdata_App_HttpException | |
\Zend_Gdata_App_InvalidArgumentException |
registerPackage(string $name) : void
Adds a Zend Framework package to the $_registeredPackages array.
Name | Type | Description |
---|---|---|
$name | string | The name of the package (eg Zend_Gdata_App) |
retrieveAllEntriesForFeed(object $feed) : mixed
Retrieve all entries for a feed, iterating through pages as necessary.
Name | Type | Description |
---|---|---|
$feed | object | The feed to iterate through. |
Type | Description |
---|---|
mixed | A new feed of the same type as the one originally passed in, containing all relevent entries. |
setGzipEnabled(boolean $enabled = false) : void
Toggle requesting gzip encoded responses
Name | Type | Description |
---|---|---|
$enabled | boolean | Whether or not to enable gzipped responses |
setHttpClient(\Zend_Http_Client $client, $applicationId = 'MyCompany-MyApp-1.0') : \Zend_Gdata_App
Set the Zend_Http_Client object used for communication
Name | Type | Description |
---|---|---|
$client | \Zend_Http_Client | The client to use for communication |
$applicationId |
Type | Description |
---|---|
\Zend_Gdata_App | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Gdata_App_HttpException |
setHttpMethodOverride(boolean $override = true) : void
Toggle using POST instead of PUT and DELETE HTTP methods
Name | Type | Description |
---|---|---|
$override | boolean | Whether to override PUT and DELETE with POST. |
setMajorProtocolVersion(int $value) : void
Set the major protocol version that should be used. Values < 1 will cause a Zend_Gdata_App_InvalidArgumentException to be thrown.
Name | Type | Description |
---|---|---|
$value | int | The major protocol version to use. |
Exception | Description |
---|---|
\Zend_Gdata_App_InvalidArgumentException |
setMaxRedirects(int $maxRedirects) : void
Set the maximum number of redirects to follow during HTTP operations
Name | Type | Description |
---|---|---|
$maxRedirects | int | Maximum number of redirects to follow |
setMinorProtocolVersion(\(int | \NULL) $value) : void
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.
Name | Type | Description |
---|---|---|
$value | \(int | \NULL) | The minor protocol version to use. |
Exception | Description |
---|---|
\Zend_Gdata_App_InvalidArgumentException |
setStaticHttpClient(\Zend_Http_Client $httpClient) : void
Set the static HTTP client instance
Name | Type | Description |
---|---|---|
$httpClient | \Zend_Http_Client |
setVerboseExceptionMessages(boolean $verbose) : void
Set whether to use verbose exception messages
Name | Type | Description |
---|---|---|
$verbose | boolean | Whether to use verbose exception messages |
updateEntry(mixed $data, $uri = null, $className = null, array $extraHeaders = array()) : \Zend_Gdata_App_Entry
Update an entry
Name | Type | Description |
---|---|---|
$data | mixed | Zend_Gdata_App_Entry or XML (w/ID and link rel='edit') |
$uri | ||
$className | ||
$extraHeaders | array | Extra headers to add to the request, as an
|
Type | Description |
---|---|
\Zend_Gdata_App_Entry | The entry returned from the server |
Exception | Description |
---|---|
\Zend_Gdata_App_Exception |
useObjectMapping(boolean $value) : void
Enable/disable the use of XML to object mapping.
Name | Type | Description |
---|---|---|
$value | boolean | Pass in true to use the XML to object mapping. Pass in false or null to disable it. |