src/Viserio/Component/Console/Command/ExpressionParser.php
private static function parseOption(string $token): InputOption
    {
        [$token, $description] = static::extractDescription(\trim($token, '[]'));

        // Shortcut [-y|--yell]
        if (\mb_strpos($token, '|') !== false) {
            [$shortcut, $token] = \explode('|', $token, 2);
            $shortcut           = \ltrim($shortcut, '-');
        } else {
            $shortcut = null;
        }

        $name    = \ltrim($token, '-');
        $default = null;

        switch (true) {
            case self::endsWith($token, '=*'):
                return new InputOption(\rtrim($name, '=*'), $shortcut, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, $description);
            case self::endsWith($token, '='):
                return new InputOption(\rtrim($name, '='), $shortcut, InputOption::VALUE_REQUIRED, $description);
            case \preg_match('/(.+)\=\*(.+)/', $token, $matches):
                return new InputOption($matches[1], $shortcut, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $description, \preg_split('/,\s?/', $matches[2]));
            case \preg_match('/(.+)\=(.+)/', $token, $matches):
                return new InputOption($matches[1], $shortcut, InputOption::VALUE_OPTIONAL, $description, $matches[2]);

            default:
                return new InputOption($token, $shortcut, InputOption::VALUE_NONE, $description);
        }
    }
private static function parseOption(string $token): InputOption
    {
        [$token, $description] = static::extractDescription(\trim($token, '[]'));

        // Shortcut [-y|--yell]
        if (\mb_strpos($token, '|') !== false) {
            [$shortcut, $token] = \explode('|', $token, 2);
            $shortcut           = \ltrim($shortcut, '-');
        } else {
            $shortcut = null;
        }

        $name    = \ltrim($token, '-');
        $default = null;

        switch (true) {
            case self::endsWith($token, '=*'):
                return new InputOption(\rtrim($name, '=*'), $shortcut, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, $description);
            case self::endsWith($token, '='):
                return new InputOption(\rtrim($name, '='), $shortcut, InputOption::VALUE_REQUIRED, $description);
            case \preg_match('/(.+)\=\*(.+)/', $token, $matches):
                return new InputOption($matches[1], $shortcut, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $description, \preg_split('/,\s?/', $matches[2]));
            case \preg_match('/(.+)\=(.+)/', $token, $matches):
                return new InputOption($matches[1], $shortcut, InputOption::VALUE_OPTIONAL, $description, $matches[2]);

            default:
                return new InputOption($token, $shortcut, InputOption::VALUE_NONE, $description);
        }
    }
Parse options.

@param string $token

@throws \Symfony\Component\Console\Exception\InvalidArgumentException

@return \Viserio\Component\Console\Input\InputOption