private function orderArguments(ReflectionMethod $method, array $args): array
    {
        $result = [];
        if (!$args) {
            return $result;
        }

        foreach ($method->getParameters() as $param) {
            if (array_key_exists($param->getName(), $args)) {
                $arg = $args[$param->getName()];

                // Fetch entity from DB
                if ($arg instanceof EntityID) {
                    $arg = $arg->getEntity();
                }

                $result[] = $arg;
            }
        }

        return $result;
    }
private function orderArguments(ReflectionMethod $method, array $args): array
    {
        $result = [];
        if (!$args) {
            return $result;
        }

        foreach ($method->getParameters() as $param) {
            if (array_key_exists($param->getName(), $args)) {
                $arg = $args[$param->getName()];

                // Fetch entity from DB
                if ($arg instanceof EntityID) {
                    $arg = $arg->getEntity();
                }

                $result[] = $arg;
            }
        }

        return $result;
    }
private function orderArguments ( ReflectionMethod $ method , array $ args ) : array { $ result = [ ] ; if ( ! $ args ) { return $ result ; } foreach ( $ method -> getParameters ( ) as $ param ) { if ( array_key_exists ( $ param -> getName ( ) , $ args ) ) { $ arg = $ args [ $ param -> getName ( ) ] ; // Fetch entity from DB if ( $ arg instanceof EntityID ) { $ arg = $ arg -> getEntity ( ) ; } $ result [ ] = $ arg ; } } return $ result ; }
Re-order associative args to ordered args

@param ReflectionMethod $method
@param array $args

@return array
Re - order associative args to ordered args