Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added ability to set custom parser
  • Loading branch information
jrmyio committed Nov 15, 2013
commit 1a0941c988ac1d1323789022cffb37e586b9fcd7
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,22 @@
*/
class ExpressionLanguage
{

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove line break

/**
* @var ParserCacheInterface
*/
private $cache;
private $lexer;
private $parser;
private $parserClass;
private $compiler;

protected $functions;

public function __construct(ParserCacheInterface $cache = null)
public function __construct(ParserCacheInterface $cache = null, $parserClass = null)
{
$this->cache = $cache ?: new ArrayParserCache();
$this->parserClass = $parserClass ?: "Symfony\\Component\\ExpressionLanguage\\Parser";
$this->functions = array();
$this->registerFunctions();
}
Expand Down Expand Up @@ -122,7 +125,7 @@ private function getLexer()
private function getParser()
{
if (null === $this->parser) {
$this->parser = new Parser($this->functions);
$this->parser = new $this->parserClass($this->functions);
}

return $this->parser;
Expand Down