예제 #1
0
 /**
  * @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;
 }
예제 #2
0
 /**
  * @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;
 }