Documentation

FeedChain
in package

Table of Contents

Properties

$branch_count  : int
Counter for the number of branches in the chain
$can_feed_node_ids  : array<string|int, mixed>
Array of Node IDs that have been processed in the current chain
$can_feed_nodes  : array<string|int, mixed>
Array of Node objects that have a 'can_feed' relationship
$link_count  : int
Counter for the number of links traversed in the chain
$reasoning  : string
String containing the reasoning for the current chain traversal
$results  : array<string|int, mixed>
Array containing the results of each node's is_feeding evaluation
$source_accounts  : array<string|int, mixed>
Array of source Material Accounts found in the chain
$stop_if_not_feeding  : bool
Flag to determine if the chain processing should stop when a node is not feeding
$current_node  : object|null
Current node being processed in the chain
$last_index  : int
Index of the last processed result
$max_links  : int
Maximum number of links to process to prevent infinite loops

Methods

add_my_results()  : void
Add results from a specific node in the chain
calculateStart()  : DateTimeInterface
Calculate the starting time for a movement
process_next_links()  : void
Process the next links in the chain

Properties

$branch_count

Counter for the number of branches in the chain

public int $branch_count = 0

$can_feed_node_ids

Array of Node IDs that have been processed in the current chain

public array<string|int, mixed> $can_feed_node_ids = array()

$can_feed_nodes

Array of Node objects that have a 'can_feed' relationship

public array<string|int, mixed> $can_feed_nodes = array()

Counter for the number of links traversed in the chain

public int $link_count = 0

$reasoning

String containing the reasoning for the current chain traversal

public string $reasoning = ''

$results

Array containing the results of each node's is_feeding evaluation

public array<string|int, mixed> $results = array()

$source_accounts

Array of source Material Accounts found in the chain

public array<string|int, mixed> $source_accounts = array()

$stop_if_not_feeding

Flag to determine if the chain processing should stop when a node is not feeding

public bool $stop_if_not_feeding = true

$current_node

Current node being processed in the chain

protected object|null $current_node = null

$last_index

Index of the last processed result

private int $last_index = 0

Maximum number of links to process to prevent infinite loops

private int $max_links = 200

Methods

add_my_results()

Add results from a specific node in the chain

public add_my_results(DateTimeInterface|null $atThisTime, object $node, bool $feeding) : void

Each link in the chain uses this method to return the results that are specific to that link. If the node is feeding, we continue processing up the chain unless we reach an account.

Parameters
$atThisTime : DateTimeInterface|null

Timestamp when the evaluation is performed

$node : object

The node being evaluated

$feeding : bool

Whether the node is feeding the downstream node

Tags
throws
Exception

calculateStart()

Calculate the starting time for a movement

public calculateStart(DateTimeInterface|null $atThisTime) : DateTimeInterface

Detects the latest datetime from all relevant states in the branch of the chain

Parameters
$atThisTime : DateTimeInterface|null

The current evaluation time

Return values
DateTimeInterface

The calculated start time

Process the next links in the chain

public process_next_links(DateTimeInterface|null $atThisTime, object $calling_node) : void

Each link in the chain uses this method to continue processing up the chain of relationships. These nested calls progressively populate the full details of the entire chain into the properties of this object. If the current link has more than one 'can_feed' relationship pointing to it, we add a branch to the chain.

Parameters
$atThisTime : DateTimeInterface|null

Timestamp when the evaluation is performed

$calling_node : object

The node from which to continue the chain

Tags
throws
Exception

        
On this page

Search results