Let's say I have 2 functions that can call each other
public static function goToAction($action,$sender_id)
{
$actions = array();
$logic = file_get_contents('../../logic/logic.json');
$logic_array = json_decode($logic, true);
unset($logic);
if (!isset($logic_array[$action])) {
return false;
} else {
foreach ($logic_array[$action] as $action) {
$actions[] = self::parseActionType($action,$sender_id);
}
}
return $actions;
}
public static function parseActionType($actions,$sender_id)
{
$data = array();
foreach ($actions as $key => $action) {
switch ($key) {
case 'goto': {
$goto_actions = self::goToAction($action,$sender_id);
foreach ($goto_actions as $goto_action){
$data[] = $goto_action;
} break;
...
}
}
return $data;
}
and here is my json file:
"no_return": [
{ "text": "Должно быть: 1, 2, 3"},
{ "text": "1" },
{ "goto": "2nr", "no_return": true},
{ "text": "5" }
],
"2nr": [
{ "text": "2" },
{ "goto": "3", "no_return": true},
{ "text": "4"}
],
"3nr": [
{ "text": "3" }
],
it returns 12345 , and its right, but how can I make it return 123 if `no_return` is setted to `true`?
What I have tried:
I dont even know how do i resolve it