Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added optimized versions of expressions
- Loading branch information
Showing
5 changed files
with
135 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
class Expression | ||
{ | ||
private $expression; | ||
protected $expression; | ||
|
||
/** | ||
* Constructor. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Symfony/Component/ExpressionLanguage/ParsedExpression.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?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; | ||
|
||
use Symfony\Component\ExpressionLanguage\Node\Node; | ||
|
||
/** | ||
* Represents an already parsed expression. | ||
* | ||
* @author Fabien Potencier <fabien@symfony.com> | ||
*/ | ||
class ParsedExpression extends Expression | ||
{ | ||
private $nodes; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param string $expression An expression | ||
* @param Node $nodes A Node representing the expression | ||
*/ | ||
public function __construct($expression, Node $nodes) | ||
{ | ||
parent::__construct($expression); | ||
|
||
$this->nodes = $nodes; | ||
} | ||
|
||
public function getNodes() | ||
{ | ||
return $this->nodes; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/Symfony/Component/ExpressionLanguage/SerializedParsedExpression.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?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; | ||
|
||
use Symfony\Component\ExpressionLanguage\Node\Node; | ||
|
||
/** | ||
* Represents an already parsed expression. | ||
* | ||
* @author Fabien Potencier <fabien@symfony.com> | ||
*/ | ||
class SerializedParsedExpression extends ParsedExpression | ||
{ | ||
private $nodes; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param string $expression An expression | ||
* @param string $nodes The serialized nodes for the expression | ||
*/ | ||
public function __construct($expression, $nodes) | ||
{ | ||
$this->expression = (string) $expression; | ||
$this->nodes = $nodes; | ||
} | ||
|
||
public function getNodes() | ||
{ | ||
return unserialize($this->nodes); | ||
} | ||
} |