PHP Trait PHPDaemon\DNode\DNode

Author: Vasily Zorin ([email protected])
Afficher le fichier Open project: kakserpom/phpdaemon

Protected Properties

Свойство Type Description
$callbacks Associative array of callback functions registered by callRemote()
$cleaned Was this object cleaned up?
$counter Incremental counter of callback functions registered by callRemote()
$localMethods Associative array of local methods, set by defineLocalMethods()
$magicCallParent Should __call method call parent::__call()?
$persistentCallbacks Associative array of persistent callback functions registered by callRemote()
$persistentMode If true, callRemote() will register callbacks as persistent ones
$remoteMethods Associative array of registered remote methods (received in 'methods' call)

Méthodes publiques

Méthode Description
__call ( string $method, array $args ) : mixed Magic __call method
callLocal ( $args ) : this Calls a local method
callRemote ( string $method, $args ) : this Calls a remote method
callRemoteArray ( string $method, array $args ) : this Calls a remote method with array of arguments
cleanup ( ) : void Swipes internal structures
ensureCallback ( &$arg ) : boolean Ensures that the variable passed by reference holds a valid callback-function If it doesn't, its value will be reset to null
exportObjectMethods ( $object ) : array Export object methods
onFinish ( ) : void Called when session is finished
onFrame ( string $data, integer $type ) : void Called when new frame is received
onHandshake ( ) : void Default onHandshake() method
onPacket ( array $pct ) : void Called when new packet is received
toJson ( mixed $m ) : this Encodes value into JSON
toJsonDebug ( mixed $m ) : void Encodes value into JSON for debugging purposes
toJsonDebugResursive ( &$m ) : void Recursion handler for toJsonDebug()

Méthodes protégées

Méthode Description
defineLocalMethods ( array $arr = [] ) : void Defines local methods
extractCallbacks ( &$args, &$list, &$path ) : void Extracts callback functions from array of arguments
getPath ( &$m, array $path ) : mixed Finds value by materialized path
methodsMethod ( array $methods ) : void Handler of the 'methods' method
sendPacket ( array $pct ) : void Sends a packet
setPath ( &$m, array $path, mixed $val ) : void Sets value by materialized path

Method Details

__call() public méthode

Magic __call method
public __call ( string $method, array $args ) : mixed
$method string Method name
$args array Arguments
Résultat mixed

callLocal() public méthode

Calls a local method
public callLocal ( $args ) : this
$args Arguments
Résultat this

callRemote() public méthode

Calls a remote method
public callRemote ( string $method, $args ) : this
$method string Method name
$args Arguments
Résultat this

callRemoteArray() public méthode

Calls a remote method with array of arguments
public callRemoteArray ( string $method, array $args ) : this
$method string Method name
$args array Arguments
Résultat this

cleanup() public méthode

Swipes internal structures
public cleanup ( ) : void
Résultat void

defineLocalMethods() protected méthode

Defines local methods
protected defineLocalMethods ( array $arr = [] ) : void
$arr array Associative array of callbacks (methodName => callback)
Résultat void

ensureCallback() public static méthode

Ensures that the variable passed by reference holds a valid callback-function If it doesn't, its value will be reset to null
public static ensureCallback ( &$arg ) : boolean
Résultat boolean

exportObjectMethods() public static méthode

Export object methods
public static exportObjectMethods ( $object ) : array
$object
Résultat array

extractCallbacks() protected méthode

Extracts callback functions from array of arguments
protected extractCallbacks ( &$args, &$list, &$path ) : void
Résultat void

getPath() protected static méthode

Finds value by materialized path
protected static getPath ( &$m, array $path ) : mixed
$path array
Résultat mixed Value

methodsMethod() protected méthode

Handler of the 'methods' method
protected methodsMethod ( array $methods ) : void
$methods array Associative array of methods
Résultat void

onFinish() public méthode

Called when session is finished
public onFinish ( ) : void
Résultat void

onFrame() public méthode

Called when new frame is received
public onFrame ( string $data, integer $type ) : void
$data string Frame's contents
$type integer Frame's type
Résultat void

onHandshake() public méthode

Default onHandshake() method
public onHandshake ( ) : void
Résultat void

onPacket() public méthode

Called when new packet is received
public onPacket ( array $pct ) : void
$pct array Packet
Résultat void

sendPacket() protected méthode

Sends a packet
protected sendPacket ( array $pct ) : void
$pct array Data
Résultat void

setPath() protected static méthode

Sets value by materialized path
protected static setPath ( &$m, array $path, mixed $val ) : void
$path array
$val mixed
Résultat void

toJson() public static méthode

Encodes value into JSON
public static toJson ( mixed $m ) : this
$m mixed Value
Résultat this

toJsonDebug() public static méthode

Encodes value into JSON for debugging purposes
public static toJsonDebug ( mixed $m ) : void
$m mixed Data
Résultat void

toJsonDebugResursive() public static méthode

Recursion handler for toJsonDebug()
public static toJsonDebugResursive ( &$m ) : void
Résultat void

Property Details

$callbacks protected_oe property

Associative array of callback functions registered by callRemote()
protected $callbacks

$cleaned protected_oe property

Was this object cleaned up?
protected $cleaned

$counter protected_oe property

Incremental counter of callback functions registered by callRemote()
protected $counter

$localMethods protected_oe property

Associative array of local methods, set by defineLocalMethods()
protected $localMethods

$magicCallParent protected_oe property

Should __call method call parent::__call()?
protected $magicCallParent

$persistentCallbacks protected_oe property

Associative array of persistent callback functions registered by callRemote()
protected $persistentCallbacks

$persistentMode protected_oe property

If true, callRemote() will register callbacks as persistent ones
protected $persistentMode

$remoteMethods protected_oe property

Associative array of registered remote methods (received in 'methods' call)
protected $remoteMethods