/** * @param $expression * @return array * @throws \Exception */ public function parseTokens($expression) { $cacheKey = md5($expression); if (isset(static::$tokenCache[$cacheKey])) { return static::$tokenCache[$cacheKey]; } $lexer = new JSONPathLexer($expression); $tokens = $lexer->parseExpression(); static::$tokenCache[$cacheKey] = $tokens; return $tokens; }
/** * @param $expression * @return array * @throws \Exception */ public function parseTokens($expression) { $cacheKey = md5($expression); if (isset(static::$tokenCache[$cacheKey])) { return static::$tokenCache[$cacheKey]; } $expression = trim($expression); $expression = preg_replace('/^\\$/', '', $expression); $lexer = new JSONPathLexer($expression); $tokens = $lexer->parseExpression(); static::$tokenCache[$cacheKey] = $tokens; return $tokens; }