\Pho\Lib\GraphGraph

Graph contains nodes

Graph contains objects that implement NodeInterface interface, such as Node and Subgraph objects, but not Edges.

Summary

Methods
Properties
Constants
on()
emit()
listeners()
removeAllListeners()
init()
add()
canEmitNodeAddSignals()
loadNodesFromArray()
loadNodesFromIDArray()
get()
contains()
remove()
members()
count()
__construct()
id()
toArray()
No public properties found
No constants found
graphToArray()
$listeners
$listeners_flat
$nodes
$node_ids
$emit_node_add_signal
N/A
No private methods found
No private properties found
N/A

Properties

$listeners

$listeners : array

The list of listeners

Type

array

$listeners_flat

$listeners_flat : 

Type

$nodes

$nodes : array

Holds nodes in ID => NodeInterface format

Type

array

$node_ids

$node_ids : array

Holds node IDs only in string formt

Type

array

$emit_node_add_signal

$emit_node_add_signal : boolean

Whether the graph and its subgraphs emit node addition.

Type

boolean

Methods

on()

on(\Pho\Lib\Graph\Event\string  $eventName,   $callBack, \Pho\Lib\Graph\Event\int  $priority = 100) : void

Subscribe to an event.

Parameters

\Pho\Lib\Graph\Event\string $eventName
$callBack
\Pho\Lib\Graph\Event\int $priority
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

emit()

emit(\Pho\Lib\Graph\Event\string  $eventName, array  $arguments = array()) 

Emits an event.

This method will return true if 0 or more listeners were succesfully handled. false is returned if one of the events broke the event chain.

Pho: Please note, continueCallback does not exist with Pho

If the continueCallBack is specified, this callback will be called every time before the next event handler is called.

If the continueCallback returns false, event propagation stops. This allows you to use the eventEmitter as a means for listeners to implement functionality in your application, and break the event loop as soon as some condition is fulfilled.

Note that returning false from an event subscriber breaks propagation and returns false, but if the continue-callback stops propagation, this is still considered a 'successful' operation and returns true.

Lastly, if there are 5 event handlers for an event. The continueCallback will be called at most 4 times.

Parameters

\Pho\Lib\Graph\Event\string $eventName
array $arguments
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

listeners()

listeners(\Pho\Lib\Graph\Event\string  $eventName, \Pho\Lib\Graph\Event\bool  $flat = false) : array<mixed,callable>

Returns the list of listeners for an event.

The list is returned as an array, and the list of events are sorted by their priority.

Parameters

\Pho\Lib\Graph\Event\string $eventName
\Pho\Lib\Graph\Event\bool $flat
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

array<mixed,callable>

removeAllListeners()

removeAllListeners(\Pho\Lib\Graph\Event\string  $eventName = null) : void

Removes all listeners.

If the eventName argument is specified, all listeners for that event are removed. If it is not specified, every listener for every event is removed.

Parameters

\Pho\Lib\Graph\Event\string $eventName
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

init()

init() 

{@inheritDoc}

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

add()

add(\Pho\Lib\Graph\NodeInterface  $node, \Pho\Lib\Graph\bool  $skip_signals = false,   $active_exceptions = false) 

{@inheritdoc}

should be able to change context of $node if $node's context is

Parameters

\Pho\Lib\Graph\NodeInterface $node
\Pho\Lib\Graph\bool $skip_signals
$active_exceptions
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

canEmitNodeAddSignals()

canEmitNodeAddSignals() : boolean

Whether the graph should emit node addition right away.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

boolean

loadNodesFromArray()

loadNodesFromArray(array  $nodes) 

{@inheritdoc}

Parameters

array $nodes
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

loadNodesFromIDArray()

loadNodesFromIDArray(array  $node_ids) 

{@inheritdoc}

Parameters

array $node_ids
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

get()

get(\Pho\Lib\Graph\ID  $node_id) 

{@inheritdoc}

Parameters

\Pho\Lib\Graph\ID $node_id
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

contains()

contains(\Pho\Lib\Graph\ID  $node_id) 

{@inheritdoc}

Parameters

\Pho\Lib\Graph\ID $node_id
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

remove()

remove(\Pho\Lib\Graph\ID  $node_id) 

{@inheritdoc}

Parameters

\Pho\Lib\Graph\ID $node_id
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

members()

members() 

{@inheritdoc}

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

count()

count() 

{@inheritdoc}

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

__construct()

__construct(\Pho\Lib\Graph\bool  $emit_node_add_signal = true) 

Constructor.

Parameters

\Pho\Lib\Graph\bool $emit_node_add_signal
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

id()

id() : \Pho\Lib\Graph\ID

Returns the ID of the Graph

Normally the Graph object does not have an ID but it is implemented it here so that the functions that query GraphInterface objects such as SubGraphs, which do have, IDs associated, will be easier to design.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

\Pho\Lib\Graph\ID

The ID

toArray()

toArray() : array

Converts the object to array

Used for serialization/unserialization. Converts internal object properties into a simple format to help with reconstruction.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

array —

The object in array format.

graphToArray()

graphToArray() : array

Converts the object to array

Used for serialization/unserialization. Converts internal object properties into a simple format to help with reconstruction.

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar:///Users/emresokullu/Code/website/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

array —

The object in array format.