X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fexpression-language%2FNode%2FArrayNode.php;fp=vendor%2Fsymfony%2Fexpression-language%2FNode%2FArrayNode.php;h=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=465527e5b7c670caa6b58f5c3c0050b699e89a86;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/symfony/expression-language/Node/ArrayNode.php b/vendor/symfony/expression-language/Node/ArrayNode.php deleted file mode 100644 index 465527e5b..000000000 --- a/vendor/symfony/expression-language/Node/ArrayNode.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class ArrayNode extends Node -{ - protected $index; - - public function __construct() - { - $this->index = -1; - } - - public function addElement(Node $value, Node $key = null) - { - if (null === $key) { - $key = new ConstantNode(++$this->index); - } - - array_push($this->nodes, $key, $value); - } - - /** - * Compiles the node to PHP. - * - * @param Compiler $compiler A Compiler instance - */ - public function compile(Compiler $compiler) - { - $compiler->raw('array('); - $this->compileArguments($compiler); - $compiler->raw(')'); - } - - public function evaluate($functions, $values) - { - $result = array(); - foreach ($this->getKeyValuePairs() as $pair) { - $result[$pair['key']->evaluate($functions, $values)] = $pair['value']->evaluate($functions, $values); - } - - return $result; - } - - protected function getKeyValuePairs() - { - $pairs = array(); - foreach (array_chunk($this->nodes, 2) as $pair) { - $pairs[] = array('key' => $pair[0], 'value' => $pair[1]); - } - - return $pairs; - } - - protected function compileArguments(Compiler $compiler, $withKeys = true) - { - $first = true; - foreach ($this->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - if ($withKeys) { - $compiler - ->compile($pair['key']) - ->raw(' => ') - ; - } - - $compiler->compile($pair['value']); - } - } -}