[ExpressionLanguage] fixed CS
This commit is contained in:
parent
db00c3f510
commit
c43c35cd17
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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;
|
namespace Symfony\Bridge\Doctrine\Tests\ExpressionLanguage;
|
||||||
|
|
||||||
use Symfony\Bridge\Doctrine\ExpressionLanguage\DoctrineParserCache;
|
use Symfony\Bridge\Doctrine\ExpressionLanguage\DoctrineParserCache;
|
||||||
|
@ -24,17 +24,16 @@ class ExpressionLanguage
|
|||||||
/**
|
/**
|
||||||
* @var ParserCacheInterface
|
* @var ParserCacheInterface
|
||||||
*/
|
*/
|
||||||
private $parserCache;
|
private $cache;
|
||||||
|
|
||||||
private $lexer;
|
private $lexer;
|
||||||
private $parser;
|
private $parser;
|
||||||
private $compiler;
|
private $compiler;
|
||||||
|
|
||||||
protected $functions;
|
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->functions = array();
|
||||||
$this->registerFunctions();
|
$this->registerFunctions();
|
||||||
}
|
}
|
||||||
@ -80,11 +79,11 @@ class ExpressionLanguage
|
|||||||
|
|
||||||
$key = $expression.'//'.implode('-', $names);
|
$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);
|
$nodes = $this->getParser()->parse($this->getLexer()->tokenize((string) $expression), $names);
|
||||||
$parsedExpression = new ParsedExpression((string) $expression, $nodes);
|
$parsedExpression = new ParsedExpression((string) $expression, $nodes);
|
||||||
|
|
||||||
$this->parserCache->save($key, $parsedExpression);
|
$this->cache->save($key, $parsedExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $parsedExpression;
|
return $parsedExpression;
|
||||||
|
@ -19,13 +19,18 @@ use Symfony\Component\ExpressionLanguage\ParsedExpression;
|
|||||||
interface ParserCacheInterface
|
interface ParserCacheInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $key
|
* Saves an expression in the cache.
|
||||||
* @param ParsedExpression $data
|
*
|
||||||
|
* @param string $key The cache key
|
||||||
|
* @param ParsedExpression $data A ParsedExpression instance to store in the cache
|
||||||
*/
|
*/
|
||||||
public function save($key, ParsedExpression $expression);
|
public function save($key, ParsedExpression $expression);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $key
|
* Fetches an expression from the cache.
|
||||||
|
*
|
||||||
|
* @param string $key The cache key
|
||||||
|
*
|
||||||
* @return ParsedExpression|null
|
* @return ParsedExpression|null
|
||||||
*/
|
*/
|
||||||
public function fetch($key);
|
public function fetch($key);
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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;
|
namespace Symfony\Component\ExpressionLanguage\Tests;
|
||||||
|
|
||||||
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
||||||
|
Reference in New Issue
Block a user