/** * Given an input of arguments, pops elements off, filters them, validates * them and returns an array of everything it consumes * * @param \r8\CLI\Input $input The input list to consume * @return Array */ public function consume(\r8\CLI\Input $input) { $result = array(); while ($input->hasNextArg()) { $arg = $this->getFilter()->filter($input->popArgument()); $this->getValidator()->ensure($arg); $result[] = $arg; } return $result; }
/** * Given an input of arguments, pops elements off, filters them, validates * them and returns an array of everything it consumes * * @param \r8\CLI\Input $input The input list to consume * @return Array */ public function consume(\r8\CLI\Input $input) { $arg = $this->getFilter()->filter($input->popArgument()); $this->getValidator()->ensure($arg); return array($arg); }