\Horde_Feed_Entry_Atom

Concrete class for working with Atom entries.

Summary

Methods
Properties
Constants
__construct()
delete()
save()
link()
No public properties found
No constants found
No protected methods found
$_httpClient
$_emptyXml
$_entryElementName
N/A
No private methods found
No private properties found
N/A

Properties

$_httpClient

$_httpClient : \Horde_Http_Client

Type

\Horde_Http_Client

$_emptyXml

$_emptyXml : string

The XML string for an "empty" Atom entry.

Type

string

$_entryElementName

$_entryElementName : string

Name of the XML element for Atom entries. Subclasses can override this to something other than "entry" if necessary.

Type

string

Methods

__construct()

__construct(  $element = null, \Horde_Http_Client  $httpClient = null) 

Handle null or array values for $this->_element by initializing with $this->_emptyXml, and importing the array with Horde_Xml_Element::fromArray() if necessary.

Parameters

$element
\Horde_Http_Client $httpClient

delete()

delete() 

Delete an atom entry.

Delete tries to delete this entry from its feed. If the entry does not contain a link rel="edit", we throw an error (either the entry does not yet exist or this is not an editable feed). If we have a link rel="edit", we do the empty-body HTTP DELETE to that URI and check for a response of 2xx. Usually the response would be 204 No Content, but the Atom Publishing Protocol permits it to be 200 OK.

Throws

\Horde_Feed_Exception

If an error occurs, an Horde_Feed_Exception will be thrown.

save()

save(string  $postUri = null, array  $headers = array()) 

Save a new or updated Atom entry.

Save is used to either create new entries or to save changes to existing ones. If we have a link rel="edit", we are changing an existing entry. In this case we re-serialize the entry and PUT it to the edit URI, checking for a 200 OK result.

For posting new entries, you must specify the $postUri parameter to save() to tell the object where to post itself. We use $postUri and POST the serialized entry there, checking for a 201 Created response. If the insert is successful, we then parse the response from the POST to get any values that the server has generated: an id, an updated time, and its new link rel="edit".

Parameters

string $postUri

Location to POST for creating new entries.

array $headers

Additional headers to transmit while posting.

Throws

\Horde_Feed_Exception

If an error occurs, a Horde_Feed_Exception will be thrown.

link()

link(string  $rel = null) : mixed

Easy access to <link> tags keyed by "rel" attributes.

Parameters

string $rel

The "rel" attribute to look for.

Returns

mixed