Gdata/App/Base.php

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

Package: Zend_Gdata\App
Abstract class for all XML elements
Children
\Zend_Gdata_App_Extension
\Zend_Gdata_App_FeedEntryParent
\Zend_Gdata_Gapps_Error
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedarray $_extensionAttributes = array()

Leftover attributes which were not handled

Default valuearray()Details
Type
array
>VPropertyprotectedarray $_extensionElements = array()

Leftover elements which were not handled

Default valuearray()Details
Type
array
>VPropertyprotectedarray $_namespaceLookupCache = array()
static

Memoized results from calls to lookupNamespace() to avoid

 expensive calls to getGreatestBoundedValue(). The key is in the
 form 'prefix-majorVersion-minorVersion', and the value is the
 output from getGreatestBoundedValue().
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_namespaces = array('atom' => array(1 => array(0 => 'http://www.w3.org/2005/Atom')), 'app' => array(1 => array(0 => 'http://purl.org/atom/app#'), 2 => array(0 => 'http://www.w3.org/2007/app')))
List of namespaces, as a three-dimensional array. The first dimension represents the namespace prefix, the second dimension represents the minimum major protocol version, and the third dimension is the minimum minor protocol version. Null keys are NOT allowed.
When looking up a namespace for a given prefix, the greatest version number (both major and minor) which is less than the effective version should be used.
Default valuearray('atom' => array(1 => array(0 => 'http://www.w3.org/2005/Atom')), 'app' => array(1 => array(0 => 'http://purl.org/atom/app#'), 2 => array(0 => 'http://www.w3.org/2007/app')))Details
Type
array
See
 
See
 
See
 
>VPropertyprotectedstring $_rootElement = null

The XML element name, including prefix if desired

Default valuenullDetails
Type
string
>VPropertyprotectedstring $_rootNamespace = 'atom'

The XML namespace prefix

Default value'atom'Details
Type
string
>VPropertyprotectedstring $_rootNamespaceURI = null

The XML namespace URI - takes precedence over lookup up the corresponding URI for $_rootNamespace

Default valuenullDetails
Type
string
>VPropertyprotectedstring $_text = null

XML child text node content

Default valuenullDetails
Type
string

Methods

methodpublic__construct() : void

methodpublic__get(string $name) : void

Magic getter to allow access like $entry->foo to call $entry->getFoo() Alternatively, if no getFoo() is defined, but a $_foo protected variable is defined, this is returned.

TODO Remove ability to bypass getFoo() methods??
Parameters
NameTypeDescription
$namestring

The variable name sought

methodpublic__isset(string $name) : void

Magic __isset method

Parameters
NameTypeDescription
$namestring
methodpublic__set(string $name,  $val) : void

Magic setter to allow acces like $entry->foo='bar' to call $entry->setFoo('bar') automatically.

Alternatively, if no setFoo() is defined, but a $_foo protected variable is defined, this is returned. TODO Remove ability to bypass getFoo() methods??
Parameters
NameTypeDescription
$namestring
$val
methodpublic__toString() : string

Magic toString method allows using this directly via echo Works best in PHP >= 4.2.0

Returns
TypeDescription
stringThe text representation of this object
methodpublic__unset(string $name) : void

Magic __unset method

Parameters
NameTypeDescription
$namestring
methodpublicencode() : string

Alias for saveXML()

Can be overridden by children to provide more complex representations of entries.
Returns
TypeDescription
stringEncoded string content
methodpublicflushNamespaceLookupCache() : void
static

Flush namespace lookup cache.

Empties the namespace lookup cache. Call this function if you have added data to the namespace lookup table that contradicts values that may have been cached during a previous call to lookupNamespace().
methodpublicgetDOM(\DOMDocument $doc = null,  $majorVersion = 1,  $minorVersion = null) : \DOMElement

Retrieves a DOMElement which corresponds to this element and all child properties. This is used to build an entry back into a DOM and eventually XML text for sending to the server upon updates, or for application storage/persistence.

Parameters
NameTypeDescription
$doc\DOMDocument

The DOMDocument used to construct DOMElements

$majorVersion
$minorVersion
Returns
TypeDescription
\DOMElementThe DOMElement representing this element and all child properties.
methodpublicgetExtensionAttributes() : array

Returns an array of all extension attributes not transformed into data model properties during parsing of the XML. Each element of the array is a hashed array of the format: array('namespaceUri' => string, 'name' => string, 'value' => string);

Returns
TypeDescription
arrayAll extension attributes
methodpublicgetExtensionElements() : array

Returns an array of all elements not matched to data model classes during the parsing of the XML

Returns
TypeDescription
arrayAll elements not matched to data model classes during parsing
methodpublicgetText( $trim = true) : string

Returns the child text node of this element This represents any raw text contained within the XML element

Parameters
NameTypeDescription
$trim
Returns
TypeDescription
stringChild text node
methodpublicgetXML() : string

Alias for saveXML() returns XML content for this element and all children

Returns
TypeDescription
stringXML content
methodpubliclookupNamespace(string $prefix, integer $majorVersion = 1, integer $minorVersion = null) : string

Get the full version of a namespace prefix

Looks up a prefix (atom:, etc.) in the list of registered namespaces and returns the full namespace URI if available. Returns the prefix, unmodified, if it's not registered.
Parameters
NameTypeDescription
$prefixstring

The namespace prefix to lookup.

$majorVersioninteger

The major protocol version in effect.

   Defaults to '1'.
$minorVersioninteger

The minor protocol version in effect.

   Defaults to null (use latest).
Returns
TypeDescription
string
methodpublicregisterAllNamespaces(array $namespaceArray) : void

Add an array of namespaces to the registered list.

Takes an array in the format of: namespace prefix, namespace URI, major protocol version, minor protocol version and adds them with calls to ->registerNamespace()
Parameters
NameTypeDescription
$namespaceArrayarray

An array of namespaces.

methodpublicregisterNamespace(string $prefix, string $namespaceUri, integer $majorVersion = 1, integer $minorVersion = 0) : void

Add a namespace and prefix to the registered list

Takes a prefix and a full namespace URI and adds them to the list of registered namespaces for use by $this->lookupNamespace(). WARNING: Currently, registering a namespace will NOT invalidate any memoized data stored in $_namespaceLookupCache. Under normal use, this behavior is acceptable. If you are adding contradictory data to the namespace lookup table, you must call flushNamespaceLookupCache().
Parameters
NameTypeDescription
$prefixstring

The namespace prefix

$namespaceUristring

The full namespace URI

$majorVersioninteger

The major protocol version in effect.

   Defaults to '1'.
$minorVersioninteger

The minor protocol version in effect.

   Defaults to null (use latest).
methodpublicsaveXML() : string

Converts this element and all children into XML text using getDOM()

Returns
TypeDescription
stringXML content
methodpublicsetExtensionAttributes(array $value) : \Zend_Gdata_App_Base

Sets an array of all extension attributes not transformed into data model properties during parsing of the XML. Each element of the array is a hashed array of the format: array('namespaceUri' => string, 'name' => string, 'value' => string); This can be used to add arbitrary attributes to any data model element

Parameters
NameTypeDescription
$valuearray

All extension attributes

Returns
TypeDescription
\Zend_Gdata_App_BaseReturns an object of the same type as 'this' to provide a fluent interface.
methodpublicsetExtensionElements(array $value) : \Zend_Gdata_App_Base

Sets an array of all elements not matched to data model classes during the parsing of the XML. This method can be used to add arbitrary child XML elements to any data model class.

Parameters
NameTypeDescription
$valuearray

All extension elements

Returns
TypeDescription
\Zend_Gdata_App_BaseReturns an object of the same type as 'this' to provide a fluent interface.
methodpublicsetText(string $value) : \Zend_Gdata_App_Base

Sets the child text node of this element This represents any raw text contained within the XML element

Parameters
NameTypeDescription
$valuestring

Child text node

Returns
TypeDescription
\Zend_Gdata_App_BaseReturns an object of the same type as 'this' to provide a fluent interface.
methodprotectedtakeAttributeFromDOM(\DOMNode $attribute) : void

Given a DOMNode representing an attribute, tries to map the data into instance members. If no mapping is defined, the name and value are stored in an array.

Parameters
NameTypeDescription
$attribute\DOMNode

The DOMNode attribute needed to be handled

methodprotectedtakeChildFromDOM(\DOMNode $child) : void

Given a child DOMNode, tries to determine how to map the data into object instance members. If no mapping is defined, Extension_Element objects are created and stored in an array.

Parameters
NameTypeDescription
$child\DOMNode

The DOMNode needed to be handled

methodpublictransferFromDOM(\DOMNode $node) : void

Transfers each child and attribute into member variables.

This is called when XML is received over the wire and the data model needs to be built to represent this XML.
Parameters
NameTypeDescription
$node\DOMNode

The DOMNode that represents this object's data

methodpublictransferFromXML(string $xml) : void

Parses the provided XML text and generates data model classes for each know element by turning the XML text into a DOM tree and calling transferFromDOM($element). The first data model element with the same name as $this->_rootElement is used and the child elements are recursively parsed.

Parameters
NameTypeDescription
$xmlstring

The XML text to parse

Documentation was generated by phpDocumentor 2.2.0 .