chg: [workflow] Renamed GraphNavigator into GraphWalker

pull/8530/head
Sami Mokaddem 2022-05-24 14:14:50 +02:00
parent 256be59135
commit 98e15e78da
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 12 additions and 12 deletions

View File

@ -73,7 +73,7 @@ class GraphUtil
}
}
class GraphNavigator
class GraphWalker
{
public function __construct(array $graphData, $startNodeID)
{
@ -132,7 +132,7 @@ class GraphNavigator
return $result;
}
public function _navigate($node_id, $path_type=null)
public function _walk($node_id, $path_type=null)
{
$this->cursor = $node_id;
$node = $this->graph[$node_id];
@ -146,15 +146,15 @@ class GraphNavigator
foreach ($outputs as $connections) {
foreach ($connections as $connection) {
$next_node_id = (int)$connection['node'];
yield from $this->_navigate($next_node_id, $path_type);
yield from $this->_walk($next_node_id, $path_type);
}
}
}
}
public function navigate()
public function walk()
{
return $this->_navigate($this->cursor);
return $this->_walk($this->cursor);
}
}
@ -230,9 +230,9 @@ class WorkflowGraphTool
// return true;
}
public static function getNavigatorIterator(array $graphData, $startNodeID)
public static function getWalkerIterator(array $graphData, $startNodeID)
{
$graphNavigator = new GraphNavigator($graphData, $startNodeID);
return $graphNavigator->navigate();
$graphWalker = new GraphWalker($graphData, $startNodeID);
return $graphWalker->walk();
}
}

View File

@ -391,16 +391,16 @@ class Workflow extends AppModel
}
/**
* navigateGraph Explore the graph and execute each nodes
* walkGraph Explore the graph and execute each nodes
*
* @param array $graphData
* @return boolean
*/
public function navigateGraph(array $workflow)
public function walkGraph(array $workflow)
{
$graphData = !empty($workflow['Workflow']) ? $workflow['Workflow']['data'] : $workflow['data'];
$navigator = $this->workflowGraphTool->getNavigatorIterator($graphData, 'publish');
foreach ($navigator as $graphNode) {
$graphWalker = $this->workflowGraphTool->getWalkerIterator($graphData, 'publish');
foreach ($graphWalker as $graphNode) {
$node = $graphNode['node'];
$path_type = $graphNode['path_type'];
$moduleClass = $this->getModuleClass($node);