Beispiel #1
0
 /**
  * Returns true if object satisfies the specification
  * @param $spec
  * @return boolean
  */
 public function isSatisfiedBy($spec)
 {
     $lang = new ExpressionLanguage();
     // TODO: add caching
     $ret = $lang->evaluate($this->generator->generate(), $spec);
     if (!is_bool($ret)) {
         throw new NotBooleanExpression();
     }
     return $ret;
 }
Beispiel #2
0
 /**
  * Generate the expression language code
  * @return string
  */
 public function generate()
 {
     return sprintf('!(%s)', $this->generator->generate());
 }