public function assemblePredicateSet(PredicateSet $predicate)
 {
     if (!$predicate->hasPredicates()) {
         return '';
     }
     return '(' . implode($predicate->getGlue(), $this->assembleSegments($predicate->getPredicates())) . ')';
 }
 public function testGettersAndSetters()
 {
     $set = new PredicateSet();
     $eq = new EqualPredicate();
     $neq = new NotEqualPredicate();
     $this->assertFalse($set->hasPredicates());
     $set->addPredicate($eq);
     $this->assertTrue($set->hasPredicates());
     $this->assertSame([$eq], $set->getPredicates());
     $set->clearPredicates();
     $set->setPredicates([$eq, $neq]);
     $this->assertTrue($set->hasPredicates());
     $set->clearPredicates();
     $this->assertFalse($set->hasPredicates());
     $this->setExpectedException("InvalidArgumentException");
     $set->setPredicates([$eq, $neq, 'abc']);
 }
 public function assemblePredicateSet(PredicateSet $predicate)
 {
     if (!$predicate->hasPredicates()) {
         return '';
     }
     $predicates = $predicate->getPredicates();
     foreach ($predicates as $p) {
         if ($p instanceof PredicateSet) {
             throw new \Exception('Cannot have multiple predicate sets in CQL');
         }
     }
     return implode($predicate->getGlue(), $this->assembleSegments($predicates));
 }