Class Brightzone\GremlinDriver\Message

InheritanceBrightzone\GremlinDriver\Message

Gremlin-server PHP Driver client Messages class Builds and parses binary messages for communication with Gremlin-server Use example:

$message = new Message;
$message->gremlin = 'g.V';
$message->op = 'eval';
$message->processor = '';
$message->setArguments(['language'=>'gremlin-groovy']);
$message->registerSerializer('\Brightzone\GremlinDriver\Serializers\Json');
// etc ...
$db = new Connection;
$db->open();
$db->send($message);

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$args array Args of the message Brightzone\GremlinDriver\Message
$configuration array Basic message configuration ie: op,processor,requestId, etc. Brightzone\GremlinDriver\Message

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Overriding construct to populate _serializer Brightzone\GremlinDriver\Message
__get() Magic getter to fetch $this->configuration + gremlin arg Brightzone\GremlinDriver\Message
__isset() Magic isset to return proper setting of $this->configuration + gremlin arg Brightzone\GremlinDriver\Message
__set() Magic setter to populate $this->configuration + gremlin arg Brightzone\GremlinDriver\Message
bindValue() Binds a value to be used inside gremlin script Brightzone\GremlinDriver\Message
buildMessage() Constructs full binary message for use in script execution Brightzone\GremlinDriver\Message
clear() Clear this message and start anew Brightzone\GremlinDriver\Message
createUuid() Create and set request UUID Brightzone\GremlinDriver\Message
getSerializer() Get the serializer object depending on a provided mimeType Brightzone\GremlinDriver\Message
parse() Parses full message (including outter envelope) Brightzone\GremlinDriver\Message
registerSerializer() Register a new serializer to this object Brightzone\GremlinDriver\Message
setArguments() Setter method for arguments This will replace existing entries. Brightzone\GremlinDriver\Message

Property Details

$args public property

Args of the message

public array $args = []
$configuration public property

Basic message configuration ie: op,processor,requestId, etc..

public array $configuration = []

Method Details

__construct() public method

Overriding construct to populate _serializer

public void __construct ( )
__get() public method

Magic getter to fetch $this->configuration + gremlin arg

public string __get ( $name )
$name string

Name of the variable you want to get

__isset() public method

Magic isset to return proper setting of $this->configuration + gremlin arg

public bool __isset ( $name )
$name string

Name of the variable you want to check

__set() public method

Magic setter to populate $this->configuration + gremlin arg

public void __set ( $name, $value )
$name string

Name of the variable you want to set

$value string

Value of the variable you want to set

bindValue() public method

Binds a value to be used inside gremlin script

public void bindValue ( $bind, $value )
$bind string

The binding name

$value mixed

The value that the binding name refers to

buildMessage() public method

Constructs full binary message for use in script execution

public string buildMessage ( )
return string

Returns binary data to be packed and sent to socket

clear() public method

Clear this message and start anew

public void clear ( )
createUuid() public method

Create and set request UUID

public string createUuid ( )
return string

The UUID

getSerializer() public method

Get the serializer object depending on a provided mimeType

public \Brightzone\GremlinDriver\SerializerInterface|bool getSerializer ( $mimeType '' )
$mimeType string

The mimeType of the serializer you want to retrieve

return \Brightzone\GremlinDriver\SerializerInterface|bool

Serializer object or FALSE if none exist.

parse() public method

Parses full message (including outter envelope)

public array parse ( $payload, $isBinary )
$payload string

Payload from the server response

$isBinary bool

Whether we should expect binary data (TRUE) or plein text (FALSE)

return array

Array containing all results

registerSerializer() public method

Register a new serializer to this object

public void registerSerializer ( $value, $default TRUE )
$value mixed

Either a serializer object or a string of the class name (with namespace)

$default bool

Whether or not to use this serializer as the default one

setArguments() public method

Setter method for arguments This will replace existing entries.

public void setArguments ( $array )
$array array

Collection of arguments