* * 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:----J8w7ze3Ocob7hWaAE83cmLmugJ3pmFWsnQkAdBj9XbSsu3aubKWXFZT9ZPUwfPtVaOnhSYQ8jtf7/MTDIIbttgx/pcVof30Na3+C7cyhuQqO7GHLtk8YDqB8+FKpv9JU6cZK2of/ZJWoqwKNSUGKKo6iZBN63iHFG2pIKVJKf45u6itm6vBigM/W1cETRqNXElkLNyhtLUavbxuDmIBd2TzXmWO7/YZga9j9VhkMwP4K5PTA5giDLorkwQFfePuO0J/zHWtA+DC4DhYrSzYOFpD2K07aR/RX1bDEgbMp17ODIZ2sBokjrpI8/zqOlCsXGtF6nW8+7dTZYscFfNUCn9rNPvC9rNZu4s0ywivHlpCTyQLvNNmxZJpQt+FdZopw/kn79RIKelyAsqw0WWth6MzEvgc8v+4fM7y1yOSVxgNYY3aFEheyj3avF579u7g5BO44YaWZJBC6Mh9Pun0yXDmkWpO1ullFkyJmD/wMk2VwbLBvw0jBFHysB9B9UxyjN5uFew7cpX4e7nl78iD4o9bVHz6FIJz3lXWjPzF95D0bkfG4bcx1QoltPvZEz343vHuTvcB/ghn+9VRvAPeH2vs8QhodNHIF/ATAghClR416KqHB32j1grgSOcg0JHgGdNcQH1b6oJluoS9U4xOWnlFvDP+MjpCjXIP+E45lRLo=----ATTACHMENT:----ODAwMzYyOTg3ODQxNTY4OCA0NTA3NDE5OTQzMjE4MjcxIDkyNjc0NjcyMjU3NzI0MjI=