Phalcon\Mvc\Model\EagerLoading\Loader::parseArguments PHP Method

parseArguments() private static method

Parses the arguments that will be resolved to Relation instances
private static parseArguments ( array $arguments ) : array
$arguments array
return array
    private static function parseArguments(array $arguments)
    {
        if (empty($arguments)) {
            throw new \InvalidArgumentException('Arguments can not be empty');
        }
        $relations = [];
        if (count($arguments) === 1 && isset($arguments[0]) && is_array($arguments[0])) {
            foreach ($arguments[0] as $relationAlias => $queryConstraints) {
                if (is_string($relationAlias)) {
                    $relations[$relationAlias] = is_callable($queryConstraints) ? $queryConstraints : null;
                } else {
                    if (is_string($queryConstraints)) {
                        $relations[$queryConstraints] = null;
                    }
                }
            }
        } else {
            foreach ($arguments as $relationAlias) {
                if (is_string($relationAlias)) {
                    $relations[$relationAlias] = null;
                }
            }
        }
        if (empty($relations)) {
            throw new \InvalidArgumentException();
        }
        return $relations;
    }