public function serializationProvider()
 {
     $key_prophecy = $this->prophesize(Key::class);
     $key_prophecy->__toString()->willReturn('foo');
     $key = $key_prophecy->reveal();
     return [[RangeExpression::lessThan($key, 42), '<range:foo lt="42">'], [RangeExpression::lessThanOrEqual($key, 42), '<range:foo lte="42">'], [RangeExpression::greaterThan($key, 42), '<range:foo gt="42">'], [RangeExpression::greaterThanOrEqual($key, 42), '<range:foo gte="42">']];
 }
Beispiel #2
0
 private function visitRangeNode(TreeNode $node)
 {
     $this->assertChildrenCount($node, 2);
     $key = $node->getChild(0)->accept($this);
     $boundary = $node->getChild(1)->accept($this);
     switch ($node->getId()) {
         case NodeTypes::LT_EXPR:
             return AST\KeyValue\RangeExpression::lessThan($key, $boundary);
         case NodeTypes::LTE_EXPR:
             return AST\KeyValue\RangeExpression::lessThanOrEqual($key, $boundary);
         case NodeTypes::GT_EXPR:
             return AST\KeyValue\RangeExpression::greaterThan($key, $boundary);
         case NodeTypes::GTE_EXPR:
             return AST\KeyValue\RangeExpression::greaterThanOrEqual($key, $boundary);
     }
 }