API Documentation

Gdata/App/Base.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: Base.php 20096 2010-01-06 02:05:09Z bkarwin $
Functions
__set
__isset
__unset
__toString
Classes
Zend_Gdata_App_Base

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

__isset

__isset( string $name ) :

Magic __isset method

Arguments

$name
string

__set

__set( string $name,  $val ) :

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??

Arguments

$name
string
$val

__toString

__toString( ) : string

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

Output

string
The text representation of this object

__unset

__unset( string $name ) :

Magic __unset method

Arguments

$name
string

Zend_Gdata_App_Base

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
Properties
$_rootElement
$_rootNamespace
$_rootNamespaceURI
$_extensionElements
$_extensionAttributes
$_text
$_namespaceLookupCache
$_namespaces
$this
$name
$name
Methods
__construct
getText
setText
getExtensionElements
setExtensionElements
getExtensionAttributes
setExtensionAttributes
getDOM
takeChildFromDOM
takeAttributeFromDOM
transferFromDOM
transferFromXML
saveXML
getXML
encode
lookupNamespace
registerNamespace
flushNamespaceLookupCache
registerAllNamespaces
__get

Description

Abstract class for all XML elements

Properties

$_extensionAttributes

array $_extensionAttributes = 'array'

Details

$_extensionAttributes
array
Leftover attributes which were not handled
visibility
protected
default
array
final
false
static
false

$_extensionElements

array $_extensionElements = 'array'

Details

$_extensionElements
array
Leftover elements which were not handled
visibility
protected
default
array
final
false
static
false

$_namespaceLookupCache

array $_namespaceLookupCache = 'array'

Details

$_namespaceLookupCache
array
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().
visibility
protected
default
array
final
false
static
true

$_namespaces

array $_namespaces = 'array'

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.

Details

$_namespaces
array
visibility
protected
default
array
final
false
static
false
see
lookupNamespace()
see
registerNamespace()
see
registerAllNamespaces()

$_rootElement

string $_rootElement = 'null'

Details

$_rootElement
string
The XML element name, including prefix if desired
visibility
protected
default
null
final
false
static
false

$_rootNamespace

string $_rootNamespace = 'atom'

Details

$_rootNamespace
string
The XML namespace prefix
visibility
protected
default
atom
final
false
static
false

$_rootNamespaceURI

string $_rootNamespaceURI = 'null'

Details

$_rootNamespaceURI
string
The XML namespace URI - takes precedence over lookup up the corresponding URI for $_rootNamespace
visibility
protected
default
null
final
false
static
false

$_text

string $_text = 'null'

Details

$_text
string
XML child text node content
visibility
protected
default
null
final
false
static
false

$name

 $name = ''

Details

visibility
public
default
final
false
static
false

$name

 $name = ' does not exist'

Details

visibility
public
default
does not exist
final
false
static
false

$this

 $this = '_'

Details

visibility
public
default
_
final
false
static
false

Methods

__construct

__construct( ) :
Details
visibility
public
final
false
static
false

__get

__get( string $name ) :

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??

Arguments
$name
string
The variable name sought
Details
visibility
public
final
false
static
false

encode

encode( ) : string

Alias for saveXML()

Can be overridden by children to provide more complex representations of entries.

Output
string
Encoded string content
Details
visibility
public
final
false
static
false

flushNamespaceLookupCache

flushNamespaceLookupCache( ) :

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().

Details
visibility
public
final
false
static
true

getDOM

getDOM( 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.

Arguments
$doc
DOMDocument
The DOMDocument used to construct DOMElements
$majorVersion
$minorVersion
Output
DOMElement
The DOMElement representing this element and all child properties.
Details
visibility
public
final
false
static
false

getExtensionAttributes

getExtensionAttributes( ) : 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);

Output
array
All extension attributes
Details
visibility
public
final
false
static
false

getExtensionElements

getExtensionElements( ) : array

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

Output
array
All elements not matched to data model classes during parsing
Details
visibility
public
final
false
static
false

getText

getText(  $trim = true ) : string

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

Arguments
$trim
Output
string
Child text node
Details
visibility
public
final
false
static
false

getXML

getXML( ) : string

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

Output
string
XML content
Details
visibility
public
final
false
static
false

lookupNamespace

lookupNamespace( 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.

Arguments
$prefix
string
The namespace prefix to lookup.
$majorVersion
integer
The major protocol version in effect. Defaults to '1'.
$minorVersion
integer
The minor protocol version in effect. Defaults to null (use latest).
Output
string
Details
visibility
public
final
false
static
false

registerAllNamespaces

registerAllNamespaces( 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()

Arguments
$namespaceArray
array
An array of namespaces.
Details
visibility
public
final
false
static
false

registerNamespace

registerNamespace( 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().

Arguments
$prefix
string
The namespace prefix
$namespaceUri
string
The full namespace URI
$majorVersion
integer
The major protocol version in effect. Defaults to '1'.
$minorVersion
integer
The minor protocol version in effect. Defaults to null (use latest).
Details
visibility
public
final
false
static
false

saveXML

saveXML( ) : string

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

Output
string
XML content
Details
visibility
public
final
false
static
false

setExtensionAttributes

setExtensionAttributes( 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

Arguments
$value
array
All extension attributes
Output
Zend_Gdata_App_Base
Returns an object of the same type as 'this' to provide a fluent interface.
Details
visibility
public
final
false
static
false

setExtensionElements

setExtensionElements( 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.

Arguments
$value
array
All extension elements
Output
Zend_Gdata_App_Base
Returns an object of the same type as 'this' to provide a fluent interface.
Details
visibility
public
final
false
static
false

setText

setText( string $value ) : Zend_Gdata_App_Base

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

Arguments
$value
string
Child text node
Output
Zend_Gdata_App_Base
Returns an object of the same type as 'this' to provide a fluent interface.
Details
visibility
public
final
false
static
false

takeAttributeFromDOM

takeAttributeFromDOM( DOMNode $attribute ) :

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.

Arguments
$attribute
DOMNode
The DOMNode attribute needed to be handled
Details
visibility
protected
final
false
static
false

takeChildFromDOM

takeChildFromDOM( DOMNode $child ) :

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.

Arguments
$child
DOMNode
The DOMNode needed to be handled
Details
visibility
protected
final
false
static
false

transferFromDOM

transferFromDOM( DOMNode $node ) :

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.

Arguments
$node
DOMNode
The DOMNode that represents this object's data
Details
visibility
public
final
false
static
false

transferFromXML

transferFromXML( string $xml ) :

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.

Arguments
$xml
string
The XML text to parse
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.