public function parse($str, $context = null) { try { return parent::parse($str, $context); } catch (\Exception $e) { throw new ParserException('Parsing failed: ' . $e->getMessage(), 0, $e); } }
/** * Parses the message and returns the tokens. * * The result is an array of tokens. * Each token is an array that consists of the token type as * first value and the message part as second value. * The token type is always one of the MessageLexer::TOKEN_* or * MessageParser::TOKEN_* constants. * * @param string $message * @param string|null $context * @return array<array<string>> The message tokens. */ public function parse($message, $context = null) { if (strpos($message, '{') === false) { // Message does not contain any declarations, therefore, we can avoid // the parsing process. return array(array(MessageLexer::TOKEN_TEXT, $message)); } return parent::parse($message, $context); }