/** * Process the result of the given node. Returns false if no other nodes * should be run, or a string with the next node name. * * @param Node $node Node that was run * * @return string */ protected function processNodeResult(Node $node) { $result = null; $name = $node->getName(); if (isset($this->nodeResults[$name])) { foreach ($this->nodeResults[$name] as $resultInfo) { if ($resultInfo->appliesTo($node)) { if ($resultInfo->isActionHangup()) { // hanging up after $name $this->client->hangup(); } elseif ($resultInfo->isActionJumpTo()) { $data = $resultInfo->getActionData(); if (isset($data['nodeEval'])) { $callback = $data['nodeEval']; $nodeName = $callback($node); } else { $nodeName = $data['nodeName']; } // jumping from $name to $nodeName $result = $nodeName; } elseif ($resultInfo->isActionExecute()) { // executing callback after $name $data = $resultInfo->getActionData(); $callback = $data['callback']; $callback($node); } } } } return $result; }