Short description of method evaluate

@access public
@author Jehan Bihin, <jehan.bihin@tudor.lu>
@param
values
@return boolean
186232
public function evaluate($values)
    {
        $returnValue = (bool) false;
        
        $rowValue = $values;
        $value = tao_helpers_Numeric::parseFloat($rowValue);
        if (empty($rowValue)) {
            $returnValue = true; // no need to go further. To check if not empty, use the NotEmpty validator
            return $returnValue;
        }
        if (! is_numeric($rowValue) || $value != $rowValue) {
            $this->setMessage(__('The value of this field must be numeric'));
            $returnValue = false;
        } else {
            if ($this->hasOption('min') || $this->hasOption('max')) {
                
                if ($this->hasOption('min') && $this->hasOption('max')) {
                    
                    if ($this->getOption('min') <= $value && $value <= $this->getOption('max')) {
                        $returnValue = true;
                    } else {
                        $this->setMessage(__('Invalid field range (minimum value: %1$s, maximum value: %2$s)', $this->getOption('min'), $this->getOption('max')));
                    }
                } elseif ($this->hasOption('min') && ! $this->hasOption('max')) {
                    if ($this->getOption('min') <= $value) {
                        $returnValue = true;
                    } else {
                        $this->setMessage(__('Invalid field range (minimum value: %s)',$this->getOption('min')));
                    }
                } elseif (! $this->hasOption('min') && $this->hasOption('max')) {
                    if ($value <= $this->getOption('max')) {
                        $returnValue = true;
                    } else {
                        $this->setMessage(__('Invalid field range (maximum value: %s)', $this->getOption('max')));
                    }
                }
            } else {
                $returnValue = true;
            }
        }
        
        // Test less, greater, equal to another
        if ($returnValue && $this->hasOption('integer2_ref') && $this->getOption('integer2_ref') instanceof tao_helpers_form_FormElement) {
            $secondElement = $this->getOption('integer2_ref');
            switch ($this->getOption('comparator')) {
                case '>':
                case 'sup':
                    if ($value > $secondElement->getRawValue()) {
                        $returnValue = true;
                    } else {
                        $returnValue = false;
                    }
                    break;
                
                case '<':
                case 'inf':
                    if ($value < $secondElement->getRawValue()) {
                        $returnValue = true;
                    } else {
                        $returnValue = false;
                    }
                    break;
                
                case '=':
                case 'equal':
                    if ($value == $secondElement->getRawValue()) {
                        $returnValue = true;
                    } else {
                        $returnValue = false;
                    }
                    break;
            }
        }
        
        return (bool) $returnValue;
    }
380304
protected Double eval(final Object[] _value)
    {
        final Double ret;

        if (_value == null) {
            ret = null;
        } else if ((_value[0] instanceof String) && (((String) _value[0]).length() > 0)) {
            ret = Double.parseDouble((String) _value[0]);
        } else if (_value[0] instanceof Number) {
            ret = ((Number) _value[0]).doubleValue();
        } else  {
            ret = null;
        }

        return ret;
    }
1105412
protected function iterate($values)
    {
        if (!is_object($values) && !is_array($values)) {
            throw new \InvalidArgumentException("Unable to validate provided object");
        }
        $errors = [];
        foreach ($this->ruleset as $field => $rules) {
            $value = $this->access($values, $field);
            $error = $rules->apply($value, $values);
            if ($error !== null) {
                $errors[$field] = count($error) > 1 || count(array_filter(array_keys($error), 'is_string')) > 0 ?
                    $error : current($error);
            }
        }
        return $errors;
    }
1230222
public function validateInteger(array $values)
    {
        if (count($values) != 1) {
            $vars = array('@field' => $this->translation->text('Condition'));
            return $this->translation->text('@field has invalid value', $vars);
        }

        $value = reset($values);

        if (strlen($value) > 10) {
            $vars = array('@max' => 10, '@field' => $this->translation->text('Value'));
            return $this->translation->text('@field must not be longer than @max characters', $vars);
        }

        if (ctype_digit($value)) {
            return true;
        }

        $vars = array('@field' => $this->translation->text('Condition'));
        return $this->translation->text('@field has invalid value', $vars);
    }
132956
public function validateValue( $value ) : bool
   {

      if ( false === $this->hasValidator() )
      {
         return true;
      }

      return (bool) ( $this->_validator )( $value );

   }
599009
public function evaluate(array $values, Context $context, Token $token)
    {
        if (count($values) !== $this->getOperands()) {
            throw new ExpressionException('Invalid number of operands for operator.',
              $this, $values);
        }
        $evaluator = $this->evaluator;
        return (string)$evaluator($values, $context, $token);
    }
1062240
public function evaluate( $values )
    {
        $returnValue = false;

        if (is_string( $values ) || is_numeric( $values )) {
            $returnValue = (preg_match( $this->getOption('format'), $values ) === 1);
        }

        return $returnValue;
    }
339683
public function setValues(array $values)
    {
        foreach ($this->type->getAttributes()->getKeys() as $attribute_name) {
            if (array_key_exists($attribute_name, $values)) {
                $this->setValue($attribute_name, $values[$attribute_name]);
            }
        }

        return $this->isValid();
    }
866108
public function contains(...$values): bool
    {
        foreach ($values as $value) {
            if ( ! $this->table->hasKey($value)) {
                return false;
            }
        }

        return true;
    }
1022116
public function valufy($values)
    {
        // we'll only deal with arrays so let's turn it into one if it isn't
        if ( ! is_array($values)) $values = [$values];

        // escape and wrap them with a quote.
        $values = array_map(function ($value)
        {
            // We need to keep the data type of values
            // except when they're strings, we need to
            // escape wrap them.
            if (is_string($value))
            {
                $value = "'" . addslashes($value) . "'";
            }
            // In order to support boolean value types and not have PHP convert them to their
            // corresponding string values, we'll have to handle boolean values and add their literal string representation.
            elseif (is_bool($value))
            {
                $value = ($value) ? 'true' : 'false';
            }

            return $value;

        }, $values);

        // stringify them.
        return implode(', ', $values);
    }
460105
public function values($values) {
		if (is_array($values))
			$this->value = $values;
		else
			$this->valueList = func_get_args();
		return $this;
	}
1336380
public function setValues($values=array()) {
		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->setValue($value);});
	}
118092
private String get(String... values) {
            if (values != null) {
                for (String value : values) {
                    if (!StringUtils.isEmpty(value)) {
                        return value;
                    }
                }
            }
            return null;
        }
988235
public function values($values = null)
    {
        deprecationWarning(
            'ValuesExpression::values() is deprecated. ' .
            'Use ValuesExpression::setValues()/getValues() instead.'
        );
        if ($values !== null) {
            return $this->setValues($values);
        }

        return $this->getValues();
    }
1139178
protected function valPropValues(array $values)
    {
        $validPropertyValues = [];

        // Run through all property values
        /** @var ValueInterface $value */
        foreach ($values as $value) {
            $this->procPropValue($value, $validPropertyValues);
        }

        return $validPropertyValues;
    }
406604
protected function convertValuesToBoolean($values)
    {
        return array_map(function ($value) {
            if ($value === 'true') {
                return true;
            } elseif ($value === 'false') {
                return false;
            }

            return $value;
        }, $values);
    }
1231482
protected Long eval(final Object... _values)
    {
        final Long ret;

        if (_values == null || _values.length == 0 || _values[0] == null)  {
            ret = null;
        } else if (_values[0] instanceof String && !"".equals(_values[0])) {
            ret = Long.parseLong((String) _values[0]);
        } else if (_values[0] instanceof Number) {
            ret = ((Number) _values[0]).longValue();
        } else  {
            ret = null;
        }

        return ret;
    }