/** * Parses a token and adds it's value to the info array * * This method looks to the generator to get a token parser and then attempts to parse * a value using that token parser. * * @access private * @param string $token The token (type) we're parding * @param string $value The value (all content after the token itself) * @return void * @throws Exception In the event the parser does not validate the value */ private function parseToken($token, $value) { $token_parser = $this->generator->getTokenParser($token); if (!$token_parser) { return; } if (!$token_parser::validate($value)) { throw new Exception('Document: %s' . PHP_EOL . 'Error: Improperly formatted docblock token and value' . PHP_EOL . 'Token: @%s %s' . PHP_EOL . 'Line (~): %s' . PHP_EOL, $this->reflection->getFileName(), $token, $value, $this->reflection->getStartLine()); } if (!isset($this->info[$token])) { $this->info[$token] = array(); } $this->info[$token][] = $token_parser::parse($value); }