/** * Outputs a word. * * @param string $part * @param string $state * * @return string */ private function template($part, $state) { if ($this->lexer->flags[$state] & Generator::STATE_FLAG_KEYWORD) { $normalized = Generator::CASE_SENSITIVE === $this->lexer->keywords[Generator::KEYWORD_INDEX_CASE_SENSITIVE] ? $part : strtolower($part); if (isset($this->lexer->keywords[Generator::KEYWORD_INDEX_LIST][$normalized])) { return $this->output->keyword($part, $this->lexer->keywords[Generator::KEYWORD_INDEX_CLASS] . $this->lexer->keywords[Generator::KEYWORD_INDEX_LIST][$normalized]); } } return $this->output->template($part, $this->lexer->classes[$state]); }
/** * Outputs a line. * * @param integer $line * @param integer $maxLineWidth * @return string */ private function line($line, $maxLineWidth) { return $this->output->template(str_pad($line, $maxLineWidth, ' ', STR_PAD_LEFT) . ': ', 'line'); }