src/CFDIReader/Scripts/Validate.php
public static function make(array $arguments): self
    {
        if (! count($arguments)) {
            throw new \InvalidArgumentException('Cannot construct without arguments');
        }
        $script = array_shift($arguments);

        $filenames = [];
        $localPath = null;
        while (null !== $argument = array_shift($arguments)) {
            if (in_array($argument, ['--local-path', '-l'])) {
                $localPath = (count($arguments)) ? array_shift($arguments) : '';
                continue;
            }
            if (false === strpos($argument, '-')) {
                $filenames[] = $argument;
                continue;
            }
            throw new \InvalidArgumentException("Invalid argument '$argument'");
        }

        $command = new self($script, $filenames);
        $command->localPath = (null !== $localPath && 'disable' === $localPath) ? '' : $localPath;
        return $command;
    }
public static function make(array $arguments): self
    {
        if (! count($arguments)) {
            throw new \InvalidArgumentException('Cannot construct without arguments');
        }
        $script = array_shift($arguments);

        $filenames = [];
        $localPath = null;
        while (null !== $argument = array_shift($arguments)) {
            if (in_array($argument, ['--local-path', '-l'])) {
                $localPath = (count($arguments)) ? array_shift($arguments) : '';
                continue;
            }
            if (false === strpos($argument, '-')) {
                $filenames[] = $argument;
                continue;
            }
            throw new \InvalidArgumentException("Invalid argument '$argument'");
        }

        $command = new self($script, $filenames);
        $command->localPath = (null !== $localPath && 'disable' === $localPath) ? '' : $localPath;
        return $command;
    }
Use this function to build the validate object from arguments values
@param string[] $arguments
@return Validate