PHP Trait PHPDaemon\DNode\DNode

Author: Vasily Zorin ([email protected])
Datei anzeigen Open project: kakserpom/phpdaemon

Protected Properties

Property 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)

Public Methods

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

Protected Methods

Method 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 method

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

callLocal() public method

Calls a local method
public callLocal ( $args ) : this
$args Arguments
return this

callRemote() public method

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

callRemoteArray() public method

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

cleanup() public method

Swipes internal structures
public cleanup ( ) : void
return void

defineLocalMethods() protected method

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

ensureCallback() public static method

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
return boolean

exportObjectMethods() public static method

Export object methods
public static exportObjectMethods ( $object ) : array
$object
return array

extractCallbacks() protected method

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

getPath() protected static method

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

methodsMethod() protected method

Handler of the 'methods' method
protected methodsMethod ( array $methods ) : void
$methods array Associative array of methods
return void

onFinish() public method

Called when session is finished
public onFinish ( ) : void
return void

onFrame() public method

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

onHandshake() public method

Default onHandshake() method
public onHandshake ( ) : void
return void

onPacket() public method

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

sendPacket() protected method

Sends a packet
protected sendPacket ( array $pct ) : void
$pct array Data
return void

setPath() protected static method

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

toJson() public static method

Encodes value into JSON
public static toJson ( mixed $m ) : this
$m mixed Value
return this

toJsonDebug() public static method

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

toJsonDebugResursive() public static method

Recursion handler for toJsonDebug()
public static toJsonDebugResursive ( &$m ) : void
return 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