ManaPHP\Cli\Arguments::get PHP Метод

get() публичный Метод

public get ( string $name = null, mixed $defaultValue = null ) : mixed
$name string
$defaultValue mixed
Результат mixed
    public function get($name = null, $defaultValue = null)
    {
        foreach (explode(':', $name) as $p) {
            $is_short = strlen($p) === 1;
            foreach ($this->_arguments as $i => $argument) {
                if ($is_short) {
                    if ($argument !== '-' . $p) {
                        continue;
                    }
                } else {
                    if ($argument !== '--' . $p) {
                        continue;
                    }
                }
                if (isset($this->_arguments[$i + 1])) {
                    if ($this->_arguments[$i + 1] === '-') {
                        throw new ArgumentsException('`:argument` argument value is invalid', ['argument' => $name]);
                    } else {
                        return $this->_arguments[$i + 1];
                    }
                }
            }
        }
        return $defaultValue;
    }