/** * Is the next thing an argument? * * @return false|SysCmdArgument */ protected function argument() { $name = ""; $value = ""; if ($this->eq("-")) { if (!(list($name) = $this->is("text"))) { throw new TextParserException("Invalid flag", $this); } list($value) = $this->is("text"); } elseif (!(list($value) = $this->is("text"))) { return false; } $arg = new SysCmdArgument(); $arg->setName($name); $arg->setValue($value); return $arg; }
/** * Appends a raw string. * * @param string $value Raw string * * @return SysCmdArgument */ public function appendString($value) { $arg = new SysCmdArgument(); $arg->setRaw(true); $arg->setValue($value); array_push($this->args, $arg); return $arg; }