* * 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 UnaryNode extends Node { private static $operators = array( '!' => '!', 'not' => '!', '+' => '+', '-' => '-', ); public function __construct($operator, Node $node) { parent::__construct( array('node' => $node), array('operator' => $operator) ); } public function compile(Compiler $compiler) { $compiler ->raw('(') ->raw(self::$operators[$this->attributes['operator']]) ->compile($this->nodes['node']) ->raw(')') ; } public function evaluate($functions, $values) { $value = $this->nodes['node']->evaluate($functions, $values); switch ($this->attributes['operator']) { case 'not': case '!': return !$value; case '-': return -$value; } return $value; } public function toArray() { return array('(', $this->attributes['operator'].' ', $this->nodes['node'], ')'); } } __halt_compiler();----SIGNATURE:----Mq78alsBV0hvApzj6bmtwTvtXU/doCcWrb+bzg0FMPxmuAC5HY+Ilf8DyjTaCHBlFgz0ZRE4y8p5maINwC3viCvrfLM6AAy9BNZNLzfCJUpet4T49Tk/MtSHq/jxfzaSCDMzn1Ri0YpZJdDfridx68qo5jVDo3SwRSh/hgzIAyaVPPN8EoUnXt5I9G3WNt1yUQ8KGiYDs7L9gCvWc6vdTFk1QuJzVVfd8HbldHbwzxa2bHbf1Oz88X/61p4iLw7B93arVT0I9MfFZaESNdpLV544klL1u6WQB2m7JCHF7admsH24nzG1CAtC4b90Fl+U9FblOHd3HH5BId/9g+tDAqq0L17alj4Bj0eMuId84bcnqbVoeZYkOJs9izoOco8avHg4MhB+sXpXFatEA8FQErWXHi0lB10If80LL9mNtXhNPTUSNwHIQfj9gOjtT8Ry7NJBN40qTWxmxjkYu/ei7kH9LCyRN/l7jjBPenSmkJQv2Dl3TWVAV68Go0Ulxg8DIejzFCP920BytF8n4YIHJPH5dd3UEYcwzKHHzWrrgDV9wJ39X3suokggdO5Z85ojNePZVRW6Vom+iLQzwNitDDRYFygnS64oApx2FBPs/Hqi+NfwW+RJHEZD77aabpi96z9W2geU1IlFHKy31gFO2RU7CahhDJ2CLttHm8zJowI=----ATTACHMENT:----NjQ0Mjc0MTkwODY2MDg5NyAzNjk0NzA4OTk0OTUyMTU5IDU5ODkyMjgwNjc5NTkwMjQ=