Share items into groups by specifying former items.
composer require master/object-order
require_once __DIR__ . '/vendor/autoload.php';
use Trzczy\Helpers\Rules;
$jsonData = '[
{
"method":"Zbigniew",
"input":"Herbert",
"arg1":24,
"arg2":"abc"
},
{
"method":"Frank",
"input":"Herbert",
"former":[
{"arg2":"abc"}
]
},
{
"method":"Edith",
"input":"Stein",
"former":[
{"method":"Frank"},
{"arg2":"abc"}
]
},
{
"method":"Ernest",
"input":"Hemingway",
"former":[
{"input":"Herbert"},
{"method":"Edith"}
]
}
]';
$rules = new Rules();
print_r($rules->order($jsonData));