Beispiel #1
0
 /**
  * Validate our comparison object
  * @param FilterInterface $condition
  * @param string $segmentName 
  * @return void
  * @throws RuntimeException
  */
 private function validateComparison(FilterInterface $condition, $segmentName)
 {
     if ($condition instanceof Truth) {
         throw new RuntimeException('The segment ' . $segmentName . ' is not a default node, but has an "always true" condition.');
     }
     $contextKey = $condition->getContextKey();
     if (!strlen($contextKey)) {
         throw new RuntimeException('The segment ' . $segmentName . ' has an empty or invalid context key.');
     }
 }
Beispiel #2
0
 /**
  * Evaluate our condition and return the boolean result
  * @return boolean
  */
 public function evaluateCondition()
 {
     if (isset($this->condition)) {
         return $this->condition->evaluate();
     }
     return true;
 }