Checks for missing required options.

@param \mako\reactor\CommandInterface $command           Command instance
@param array                          $providedArguments Provided arguments
502227
protected function checkForMissingOptions(CommandInterface $command, array $providedArguments): void
	{
		$this->checkForMissingArgumentsOrOptions($command->getCommandOptions(), $providedArguments, MissingOptionException::class);
	}
56784
private function hasTooManyArguments(array $argumentValues, array $commandArguments) : bool
    {
        if (count($argumentValues) > count($commandArguments)) {
            // Only when the last argument is an array do we allow more request arguments than command arguments
            if (count($commandArguments) === 0 || !end($commandArguments)->isArray()) {
                return true;
            }
        }

        return false;
    }
1049464
private function processArguments(RawArgs $args, CommandCollection $namedCommands, array $argumentsToTest, array $optionsToTest)
    {
        $currentCommand = null;

        // Parse the arguments for command names until we fail to find a
        // matching command
        foreach ($argumentsToTest as $name) {
            if (!$namedCommands->contains($name)) {
                break;
            }

            $nextCommand = $namedCommands->get($name);

            if ($nextCommand->getConfig() instanceof OptionCommandConfig) {
                break;
            }

            $currentCommand = $nextCommand;
            $namedCommands = $currentCommand->getNamedSubCommands();
        }

        if (!$currentCommand) {
            return null;
        }

        return $this->processOptions($args, $currentCommand, $optionsToTest);
    }
958712
final public function handle(Command $command): void
    {
        $supportedCommandType = $this->getSupportedCommandType();
        if (!\is_a($command, $supportedCommandType)) {
            throw new InvalidCommandException(\sprintf(
                'Command must be a %s, %s given',
                $supportedCommandType,
                \get_class($command)
            ));
        }

        $this->handleCommand($command);
    }
805412
public function checkCommandArguments()
    {
        foreach ($this->commandArguments as $index => $argument) {
            $argument->addParameters($this->arguments);

            if ($argument->isRequired() && !$argument->hasBeenProvided()) {
                throw new \Parable\Console\Exception(
                    "Required argument with index #{$index} '{$argument->getName()}' not provided."
                );
            }
        }
    }
341755
public static function interleaved(CommandInterface $command, $prefix)
    {
        if ($arguments = $command->getArguments()) {
            $length = count($arguments);

            for ($i = 0; $i < $length; $i += 2) {
                $arguments[$i] = "$prefix{$arguments[$i]}";
            }

            $command->setRawArguments($arguments);
        }
    }
716442
private function cleanExtraCommandArgument(Command $command): void
    {
        $arguments = $command->getDefinition()->getArguments();
        if (! isset($arguments['command'])) {
            return;
        }

        unset($arguments['command']);
        $command->getDefinition()->setArguments($arguments);
    }
330308
protected function prepareEvent($command, array $args)
    {
        if (is_null($this->eventDispatcher)) {
            return null;
        }

        $event = new CassandraEvent();
        $event->setCommand($command)
              ->setKeyspace($this->getKeyspace())
              ->setArguments($args)
              ->setExecutionStart();

        return $event;
    }
1093199
protected function getKeyFromInterleavedArguments(string $command, array $arguments)
    {
        $keys = [];

        for ($i = 0, $n = \count($arguments); $i < $n; $i += 2) {
            $keys[] = $arguments[$i];
        }

        if ($this->checkSameSlotForKeys($keys)) {
            return $arguments[0];
        }

        return null;
    }
272992
static function checkRequiredParametersAreSet(array $given, array $required)
    {
        foreach ($required as $key) {
            if (empty($given[$key])) {
                throw new MissingRequiredParameterException(
                        "Missing required parameter '$key'"
                );
            }
        }
    }
344472
public function setProvidedOptions($providedOptions = [])
    {
        $this->providedOptions = $providedOptions;

        if (isset($this->providedOptions['png'])) {
            if ($this->getMimeTypeOfSource() == 'image/png') {
                $this->providedOptions = array_merge($this->providedOptions, $this->providedOptions['png']);
//                $this->logLn(print_r($this->providedOptions, true));
            }
        }

        if (isset($this->providedOptions['jpeg'])) {
            if ($this->getMimeTypeOfSource() == 'image/jpeg') {
                $this->providedOptions = array_merge($this->providedOptions, $this->providedOptions['jpeg']);
            }
        }
        // -  Merge $defaultOptions into provided options
        $this->options = array_merge($this->getDefaultOptions(), $this->providedOptions);
    }
645376
public function onCommandBeforePrepare(Event $event) {
        /** @var Command $command */
        $command = $event['command'];
        if (in_array($command->getName(), $this->commands)) {
            // Get the interesting parameters
            $source = $command->get($this->sourceParameter);
            $body = $command->get($this->bodyParameter);

            // If a file path is passed in then get the file handle
            if (is_string($source) && file_exists($source)) {
                $body = fopen($source, 'rb');
            }

            // Prepare the body parameter and remove the source file parameter
            if (null !== $body) {
                $command->remove($this->sourceParameter);
                $command->set($this->bodyParameter, EntityBody::factory($body));
            } else {
                throw new InvalidArgumentException(
                        "You must specify a non-null value for the {$this->bodyParameter} or {$this->sourceParameter} parameters.");
            }
        }
    }
821528
private function execute(CommandInterface $command)
    {
        $handler = $this->locator->locate($command);

        if (!$handler->supports($command)) {
            throw new InvalidCommandException(sprintf('The registered command handler doesn\'t support "%s"', get_class($command)));
        }

        $this->executing = true;

        $handler->execute($command);

        $this->executing = false;
    }
32617
public function register(CommandInterface $command)
    {
        /*
         * Gets the name of the command
         * @var string
         */
        $name = $command->getCommand();

        /*
         * Check if the command isn't already registered
         * otherwise throw an exception
         */
        if (array_key_exists($name, $this->commands)) {
            throw new CommandException("Command with name '$name' already registered");
        }

        /*
         * Adds the command to the array
         */
        $this->commands[$name] = $command;
    }
691433
public function prepare($command, array $arguments = array())
    {
        $commandline = $command;

        foreach ($arguments as $option => $value) {
            if (is_bool($value)) {
                if ($value === true) {
                    $commandline .= ' ' . $option;
                }
            } else {
                $seperator = ' ';
                if (!is_integer($option)) {
                    $commandline .= ' ' . $option;
                    if (substr($option, -1, 1) == '=') {
                        $seperator = '';
                    }
                }
                $commandline .= $seperator . ProcessUtils::escapeArgument($value);
            }
        }

        return $commandline;
    }
272554
public function command($command)
    {
        if ($command instanceof CommandInterface) {
            $command->setContainer($this);
        }

        $this['console']->add($command);
    }
116793
protected function _getArgumentValues($controller, $command, $argumentName)
    {
        $controllerClassName = $this->_getControllerClassName($controller);
        if (!class_exists($controllerClassName)) {
            return [];
        }

        $argument_values = [];
        $command = Text::camelize($command) . 'Completion';
        if (method_exists($controllerClassName, $command)) {
            try {
                $argument_values = (new $controllerClassName())->$command($argumentName);
            } catch (\Exception $e) {

            }
        }

        return $argument_values;
    }