* * 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; /** * Represents a node in the AST. * * @author Fabien Potencier */ class Node { public $nodes = array(); public $attributes = array(); /** * @param array $nodes An array of nodes * @param array $attributes An array of attributes */ public function __construct(array $nodes = array(), array $attributes = array()) { $this->nodes = $nodes; $this->attributes = $attributes; } public function __toString() { $attributes = array(); foreach ($this->attributes as $name => $value) { $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); } $repr = array(str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', get_class($this)).'('.implode(', ', $attributes)); if (count($this->nodes)) { foreach ($this->nodes as $node) { foreach (explode("\n", (string) $node) as $line) { $repr[] = ' '.$line; } } $repr[] = ')'; } else { $repr[0] .= ')'; } return implode("\n", $repr); } public function compile(Compiler $compiler) { foreach ($this->nodes as $node) { $node->compile($compiler); } } public function evaluate($functions, $values) { $results = array(); foreach ($this->nodes as $node) { $results[] = $node->evaluate($functions, $values); } return $results; } public function toArray() { throw new \BadMethodCallException(sprintf('Dumping a "%s" instance is not supported yet.', get_class($this))); } public function dump() { $dump = ''; foreach ($this->toArray() as $v) { $dump .= is_scalar($v) ? $v : $v->dump(); } return $dump; } protected function dumpString($value) { return sprintf('"%s"', addcslashes($value, "\0\t\"\\")); } protected function isHash(array $value) { $expectedKey = 0; foreach ($value as $key => $val) { if ($key !== $expectedKey++) { return true; } } return false; } } __halt_compiler();----SIGNATURE:----M5rnLqD1a4Rc95R72xJNfnhH9SZms47yROkXWq4Afdrsuk4LUhUcPk9B8Fgms97Sx18hKuR95xlaPSZ867s/qiAbzA8CyDk7dgDl9LYsKC366cTwp1EETag6gr+9+fw5Xx0Tn2JB+JhL5sfy83sxRsr+AZb9LdTIaUQkt8cJPOshwpy+wFlN6yYWUN0rjEk+nMCf1gy2rw6dCxe43WU5DI4h/czUwFBJnqenIDEUka3uLkXwPNt5wOpdE8iR77DuzDTD4Ax51Eg8ZuqsT2wQPHz3ePp9j9s+L1o2n0eJBO1gi6cUgFTO3yNYAMF3eC3QKF86FpTKkXbGCl/EscNvMHQLObKTrZvOjE0oM5xZdoFqYwB1s6XD/9XNyU9AauMypdRn2PLZdzzt1UlMiLqMfBdTS+OpiW+LsV6f/KNq2sRpX4mJ2KIeCUIJMHbhrJWXA5PwI4/r9czOtuaGGaq5isYqJp+JThg6VK7Jua/GcgxHj6Hr/A6D8FlDVSkg1ZjPYSX5/bvwgdzhgI3ss5AsND8F5IfAdpvNINGHpPt6n/RtVWTI6NuWohPXLyYWkQghWhaOHwS7/g89PjCYW7tqC0abX+0KzJgO0b8MvyQv7d8UsK+zYADnf4EkZFCQSBivBmflq4fiHoPLhgYJmMJt1xf9liYRqEcREvSYacxThMg=----ATTACHMENT:----NDQ0NjA0OTY2NjcwMDI1NiA5MTgzNjUzMzg1ODM5MTIxIDEwNjYxNDQ3NzMwNzY4Ng==