/** * @param callable $predicate * * @return string */ protected function readWhile(callable $predicate) { $str = ""; while (!$this->input->eof() && call_user_func($predicate, $this->input->peek())) { $str .= $this->input->next(); } return $str; }