Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function __invoke(array $data)
 {
     if (!isset($this->ast)) {
         $tokens = ExpressionParser::lex($this->expr, $this->vars);
         $this->ast = ExpressionParser::parseExpression($tokens);
     }
     return $this->ast->__invoke($data);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function toString(Quoter $quoter)
 {
     if (!$this->left instanceof Atomic) {
         return '(' . $this->left->toString($quoter) . ') ' . $this->operator . ' ' . $this->right->toString($quoter);
     }
     return $this->left->toString($quoter) . ' ' . $this->operator . ' ' . $this->right->toString($quoter);
 }