Exemple #1
0
 /**
  * Set Contains comparison.
  *
  * @param Value $value Value object to compare against
  *
  * @return boolean
  */
 public function setContains(Value $value)
 {
     if (is_array($value->getValue())) {
         foreach ($this->value as $val) {
             if ($val instanceof Set && $val == $value->getSet()) {
                 return true;
             }
         }
         return false;
     }
     return in_array($value->getValue(), $this->value);
 }
 /**
  * @return array
  */
 public function getParameters()
 {
     $params = [];
     if (is_array($v = $this->value->getValue()) && $this->value->getOperator() === 'BETWEEN') {
         foreach ($v as $index => $value) {
             $params[$this->value->getParameterKey($index)] = $value;
         }
     } elseif ($this->value->getOperator() === 'IS') {
         // conitnue...
     } elseif ($this->value->getOperator() === 'INSTANCE OF') {
         // conitnue...
     } else {
         $params[$this->value->getParameterKey()] = $this->value->getValue();
     }
     return $params;
 }
 /**
  * {@inheritDoc}
  */
 public function walkValue(Value $value)
 {
     return $value->getValue();
 }
Exemple #4
0
 public function exponentiate(Value $value)
 {
     if (!is_numeric($this->value) || !is_numeric($value->getValue())) {
         throw new \RuntimeException("Arithmetic: values must be numeric");
     }
     return pow($this->value, $value->getValue());
 }
Exemple #5
0
 /**
  * Less Than comparison.
  *
  * @param  Value $value
  * @return boolean
  */
 public function lessThan(Value $value)
 {
     return $this->value < $value->getValue();
 }