Documentation

Horde_SyncMl_Command_Sync extends Horde_SyncMl_Command
in package

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.

Tags
author

Karsten Fourmont karsten@horde.org

author

Jan Schneider jan@horde.org

Table of Contents

$_chars  : string
Buffer for the parsed character data.
$_cmdID  : int
The command ID (<CmdID>).
$_cmdName  : string
Name of the command.
$_contentFormat  : string
Encoding format of the content as specified in the <Meta><Format> element, like 'b64'.
$_contentType  : string
The MIME content type of the currently parsed sync command as specified by the <Type> element inside a <Meta> section.
$_curItem  : Horde_SyncMl_SyncElement
Horde_SyncMl_SyncElement object for the currently parsed sync command.
$_elementType  : string
Name of the currently parsed sync command, like 'Add'.
$_itemCmdID  : int
The command ID (<CmdID>) of the currently parsed sync command.
$_itemMoreData  : bool
Whether a <MoreData> element has indicated that the sync command is split into several SyncML message chunks.
$_itemSize  : int
The size of the data item of the currently parsed sync command in bytes as specified by a <Size> element.
$_outputHandler  : Horde_SyncMl_XmlOutput
A Horde_SyncMl_XmlOutput instance responsible for generating the output.
$_sourceURI  : string
Source database of the <Sync> command.
$_stack  : array<string|int, mixed>
Stack for holding the XML elements during creation of the object from the XML event flow.
$_syncElements  : array<string|int, mixed>
List of all Horde_SyncMl_SyncElement objects that have parsed.
$_targetURI  : string
Target database of the <Sync> command.
__construct()  : mixed
Constructor.
characters()  : mixed
Character data handler for the XML parser, delegated from Horde_SyncMl_ContentHandler::characters().
endElement()  : mixed
End element handler for the XML parser, delegated from Horde_SyncMl_ContentHandler::endElement().
factory()  : Horde_SyncMl_Command
Attempts to return a concrete Horde_SyncMl_Command instance based on $command.
getCommandName()  : string
Returns the command name this instance is reponsible for.
handleCommand()  : mixed
Implements the actual business logic of the Sync command.
startElement()  : mixed
Start element handler for the XML parser, delegated from Horde_SyncMl_ContentHandler::startElement().
_outputStatus()  : mixed
Creates the <Status> response for one Add|Replace|Delete SyncElement.

Properties

$_chars

Buffer for the parsed character data.

protected string $_chars = ''

$_cmdID

The command ID (<CmdID>).

protected int $_cmdID

$_cmdName

Name of the command.

protected string $_cmdName = 'Sync'

$_contentFormat

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

protected string $_contentFormat = 'chr'

$_contentType

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

protected string $_contentType = 'text/plain'

$_elementType

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

protected string $_elementType

$_itemCmdID

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

protected int $_itemCmdID

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

$_itemMoreData

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

protected bool $_itemMoreData

$_itemSize

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

protected int $_itemSize

$_sourceURI

Source database of the <Sync> command.

protected string $_sourceURI

$_stack

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

protected array<string|int, mixed> $_stack = array()

$_syncElements

List of all Horde_SyncMl_SyncElement objects that have parsed.

protected array<string|int, mixed> $_syncElements = array()

$_targetURI

Target database of the <Sync> command.

protected string $_targetURI

Methods

characters()

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

public characters(string $str) : mixed
Parameters
$str : string

The data string.

Return values
mixed

endElement()

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

public endElement(string $uri, string $element) : mixed
Parameters
$uri : string

The namespace URI of the element.

$element : string

The element tag name.

Return values
mixed

factory()

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

public factory(string $command, Horde_SyncMl_XmlOutput &$outputHandler) : Horde_SyncMl_Command
Parameters
$command : string

The type of the concrete Horde_SyncMl_Comment subclass to return.

$outputHandler : Horde_SyncMl_XmlOutput

A Horde_SyncMl_XmlOutput object.

Return values
Horde_SyncMl_Command

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

getCommandName()

Returns the command name this instance is reponsible for.

public getCommandName() : string
Return values
string

The command name this object is handling.

handleCommand()

Implements the actual business logic of the Sync command.

public handleCommand([mixed $debug = false ]) : mixed
Parameters
$debug : mixed = false
Return values
mixed

startElement()

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

public startElement(string $uri, string $element, array<string|int, mixed> $attrs) : mixed
Parameters
$uri : string

The namespace URI of the element.

$element : string

The element tag name.

$attrs : array<string|int, mixed>

A hash with the element's attributes.

Return values
mixed

_outputStatus()

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

protected _outputStatus(Horde_SyncMl_SyncElement $element) : mixed
Parameters
$element : Horde_SyncMl_SyncElement

The element for which the status is to be created.

Return values
mixed

Search results