[ExpressionLanguage] fixed CS
This commit is contained in:
parent
db00c3f510
commit
c43c35cd17
|
@ -1,5 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bridge\Doctrine\Tests\ExpressionLanguage;
|
||||
|
||||
use Symfony\Bridge\Doctrine\ExpressionLanguage\DoctrineParserCache;
|
||||
|
|
|
@ -24,17 +24,16 @@ class ExpressionLanguage
|
|||
/**
|
||||
* @var ParserCacheInterface
|
||||
*/
|
||||
private $parserCache;
|
||||
|
||||
private $cache;
|
||||
private $lexer;
|
||||
private $parser;
|
||||
private $compiler;
|
||||
|
||||
protected $functions;
|
||||
|
||||
public function __construct(ParserCacheInterface $parserCache = null)
|
||||
public function __construct(ParserCacheInterface $cache = null)
|
||||
{
|
||||
$this->parserCache = $parserCache ?: new ArrayParserCache();
|
||||
$this->cache = $cache ?: new ArrayParserCache();
|
||||
$this->functions = array();
|
||||
$this->registerFunctions();
|
||||
}
|
||||
|
@ -80,11 +79,11 @@ class ExpressionLanguage
|
|||
|
||||
$key = $expression.'//'.implode('-', $names);
|
||||
|
||||
if (null === $parsedExpression = $this->parserCache->fetch($key)) {
|
||||
if (null === $parsedExpression = $this->cache->fetch($key)) {
|
||||
$nodes = $this->getParser()->parse($this->getLexer()->tokenize((string) $expression), $names);
|
||||
$parsedExpression = new ParsedExpression((string) $expression, $nodes);
|
||||
|
||||
$this->parserCache->save($key, $parsedExpression);
|
||||
$this->cache->save($key, $parsedExpression);
|
||||
}
|
||||
|
||||
return $parsedExpression;
|
||||
|
|
|
@ -19,13 +19,18 @@ use Symfony\Component\ExpressionLanguage\ParsedExpression;
|
|||
interface ParserCacheInterface
|
||||
{
|
||||
/**
|
||||
* @param string $key
|
||||
* @param ParsedExpression $data
|
||||
* Saves an expression in the cache.
|
||||
*
|
||||
* @param string $key The cache key
|
||||
* @param ParsedExpression $data A ParsedExpression instance to store in the cache
|
||||
*/
|
||||
public function save($key, ParsedExpression $expression);
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* Fetches an expression from the cache.
|
||||
*
|
||||
* @param string $key The cache key
|
||||
*
|
||||
* @return ParsedExpression|null
|
||||
*/
|
||||
public function fetch($key);
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\ExpressionLanguage\Tests;
|
||||
|
||||
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
||||
|
|
Reference in New Issue