\Horde_SyncMl_Command_Sync

The Horde_SyncMl_Command_Sync class provides a SyncML implementation of the Sync command as defined in SyncML Representation Protocol, version 1.1, section 5.5.15.

The Sync command is used to indicate a data synchronization operation. The command handler for the Sync command is the central class to dispatch sync messages.

During parsing of the received XML, the actual sync commands (Add, Replace, Delete) from the client are stored in the $_syncElements attribute. When the output method of Horde_SyncMl_Command_Sync is called, these elements are processed and the resulting status messages created. Then the server modifications are sent back to the client by the handleSync() method which is called from within the output method.

Copyright 2005-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Summary

Methods
Properties
Constants
__construct()
startElement()
endElement()
characters()
getCommandName()
handleCommand()
factory()
No public properties found
No constants found
_outputStatus()
$_cmdName
$_cmdID
$_stack
$_chars
$_outputHandler
$_sourceURI
$_targetURI
$_curItem
$_syncElements
$_contentType
$_contentFormat
$_itemCmdID
$_elementType
$_itemMoreData
$_itemSize
N/A
No private methods found
No private properties found
N/A

Properties

$_cmdName

$_cmdName : string

Name of the command.

Must be overwritten by a sub class.

Type

string

$_cmdID

$_cmdID : integer

The command ID (<CmdID>).

Type

integer

$_stack

$_stack : array

Stack for holding the XML elements during creation of the object from the XML event flow.

Type

array

$_chars

$_chars : string

Buffer for the parsed character data.

Type

string

$_outputHandler

$_outputHandler : \Horde_SyncMl_XmlOutput

A Horde_SyncMl_XmlOutput instance responsible for generating the output.

Type

\Horde_SyncMl_XmlOutput

$_sourceURI

$_sourceURI : string

Source database of the <Sync> command.

Type

string

$_targetURI

$_targetURI : string

Target database of the <Sync> command.

Type

string

$_curItem

$_curItem : \Horde_SyncMl_SyncElement

Horde_SyncMl_SyncElement object for the currently parsed sync command.

Type

\Horde_SyncMl_SyncElement

$_syncElements

$_syncElements : array

List of all Horde_SyncMl_SyncElement objects that have parsed.

Type

array

$_contentType

$_contentType : string

The MIME content type of the currently parsed sync command as specified by the <Type> element inside a <Meta> section.

Type

string

$_contentFormat

$_contentFormat : string

Encoding format of the content as specified in the <Meta><Format> element, like 'b64'.

Type

string

$_itemCmdID

$_itemCmdID : integer

The command ID (<CmdID>) of the currently parsed sync command.

This is different from the command ID of the command itself.

Type

integer

$_elementType

$_elementType : string

Name of the currently parsed sync command, like 'Add'.

Type

string

$_itemMoreData

$_itemMoreData : boolean

Whether a <MoreData> element has indicated that the sync command is split into several SyncML message chunks.

Type

boolean

$_itemSize

$_itemSize : integer

The size of the data item of the currently parsed sync command in bytes as specified by a <Size> element.

Type

integer

Methods

__construct()

__construct(\Horde_SyncMl_XmlOutput  $outputHandler) 

Constructor.

Parameters

\Horde_SyncMl_XmlOutput $outputHandler

A Horde_SyncMl_XmlOutput object.

startElement()

startElement(string  $uri, string  $element, array  $attrs) 

Start element handler for the XML parser, delegated from Horde_SyncMl_ContentHandler::startElement().

Parameters

string $uri

The namespace URI of the element.

string $element

The element tag name.

array $attrs

A hash with the element's attributes.

endElement()

endElement(string  $uri, string  $element) 

End element handler for the XML parser, delegated from Horde_SyncMl_ContentHandler::endElement().

Parameters

string $uri

The namespace URI of the element.

string $element

The element tag name.

characters()

characters(string  $str) 

Character data handler for the XML parser, delegated from Horde_SyncMl_ContentHandler::characters().

Parameters

string $str

The data string.

getCommandName()

getCommandName() : string

Returns the command name this instance is reponsible for.

Returns

string —

The command name this object is handling.

handleCommand()

handleCommand(  $debug = false) 

Implements the actual business logic of the Sync command.

Parameters

$debug

factory()

factory(string  $command, \Horde_SyncMl_XmlOutput  $outputHandler) : \Horde_SyncMl_Command

Attempts to return a concrete Horde_SyncMl_Command instance based on $command.

Parameters

string $command

The type of the concrete Horde_SyncMl_Comment subclass to return.

\Horde_SyncMl_XmlOutput $outputHandler

A Horde_SyncMl_XmlOutput object.

Returns

\Horde_SyncMl_Command

The newly created concrete Horde_SyncMl_Command instance, or false on error.

_outputStatus()

_outputStatus(\Horde_SyncMl_SyncElement  $element) 

Creates the <Status> response for one Add|Replace|Delete SyncElement.

Parameters

\Horde_SyncMl_SyncElement $element

The element for which the status is to be created.