Validates the date condition
@param array $values
@return boolean|string
972148
public function date(array $values)
    {
        if (count($values) != 1) {
            $vars = array('@field' => $this->translation->text('Condition'));
            return $this->translation->text('@field has invalid value', $vars);
        }

        $timestamp = strtotime(reset($values));

        if (empty($timestamp)) {
            $vars = array('@field' => $this->translation->text('Condition'));
            return $this->translation->text('@field has invalid value', $vars);
        }

        return true;
    }
636498
public function setValues(array $values)
    {
        foreach ($values as $value) {
            $this->checkType(\DateTime::class, $value, true);
        }
        parent::setValues($values);
    }
675409
final public static function hasValue (...$values) : bool
	{
		foreach ($values as $value):
			if (is_array($value)):
				if (!(isset($value) AND (!empty($value)))):
					return FALSE; break;
				endif;
			else:
				$trimmedValue = trim($value);
				if (!(isset($trimmedValue) AND ($trimmedValue !== ""))):
					return FALSE; break;
				endif;
			endif;
		endforeach;
		return TRUE;
	}
1295412
public static function validate($types, ...$values): bool
    {
        try {
            return self::typeOf($types, ...$values);
        } catch (Throwable $t) {
            // We won't do anything
        }

        return false;
    }
327383
public function validateProperties(array $properties): bool
    {
        foreach ($properties as $property => $allowed) {
            $this->validateProperty($property, $allowed);
        }

        return true;
    }
937991
public function isValidDate($value)
    {
        if (!$value) {
            return false;
        }

        try {
            new \DateTime($value);

            return true;
        } catch (\Exception $e) {
            return false;
        }
    }
1221721
public function isValid($value)
    {
        if ($this->skipValidation)
            return true;

        $datatype = $this->validation['datatype'];

        //NULL check, empty strings are considered null
        if(in_array($datatype, array('string', 'url', 'email', 'slug', 'slugwithslash', 'html', 'binary','json'))
          && strlen(trim($value)) == 0)
            $value = null;

        if ($this->validation['nullable'] === false && $value === null && $datatype != 'boolean') {
            $this->failureCode = 'nullable';
            $this->failureMessage = 'cannot be empty';
            return false;
        }

        //Nothing more to validate if the value is null...
        if ($value === null)
            return true;


        //Check date makes sense
        if ($datatype === 'date') {

            //todo: not sure how to check validity of date... it's already a DateTime instance.
            if (false) {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is an invalid date';
                return false;
            }
        }


        //Validate MIN
        $min = $this->validation['min'];

        if ($min != null) {
            if ($datatype === 'float') {
                if($value < floatval($min)) {
                    $this->failureCode = 'min';
                    $this->failureMessage = 'is less than the minimum value';
                    return false;
                }
            } else if ($datatype === 'int') {
                if($value < intval($min)) {
                    $this->failureCode = 'min';
                    $this->failureMessage = 'is less than the minimum value';
                    return false;
                }
            } else {

                if (is_string($value) && strlen($value) < intval($min)) {
                    $this->failureCode = 'minlength';
                    $this->failureMessage = 'must be at least '.($min).' characters';
                    return false;
                }
            }
        }


        //Validate MAX
        $max = $this->validation['max'];

        if ($max != null) {
            if ($datatype === 'float') {
                if($value > floatval($max)) {
                    $this->failureCode = 'max';
                    $this->failureMessage = 'is more than the maximum value';
                    return false;
                }
            } else if ($datatype === 'int') {
                if($value > intval($max)) {
                    $this->failureCode = 'max';
                    $this->failureMessage = 'is more than the maximum value';
                    return false;
                }
            } else {

                $maxbytes = intval($max);

                if(intval($max) < 255)
                {
                    // count characters

                    if (is_string($value) && StringUtils::charCount($value) > intval($max)) {
                        $this->failureCode = 'maxlength';
                        $this->failureMessage = 'must be a maximum of '.($max).' characters';
                        return false;
                    }

                    $maxbytes = 255;

                }

                // count bytes
                if (is_string($value) && StringUtils::byteCount($value) > intval($maxbytes)) {
                    $this->failureCode = 'maxlength';
                    $this->failureMessage = 'must be a maximum of '.($maxbytes).' bytes';
                    return false;
                }
            }
        }

        if($datatype === 'slug')
        {
            if(!SlugUtils::isSlug($value, false))
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid slug, cannot contain slashes';
                return false;
            }
        }

        if($datatype === 'slugwithslash')
        {
            if(!SlugUtils::isSlug($value, true))
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid slug';
                return false;
            }
        }

        if($datatype === 'url')
        {
            if(!URLUtils::isUrl($value))
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid URL';
                return false;
            }
        }

        if($datatype === 'email')
        {
            if(!EmailUtils::isEmailAddress($value))
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid email address';
                return false;
            }
        }

        if($datatype === 'json')
        {
            if(!JSONUtils::isValid($value)) //todo: get exact error message here
            {
                $this->failureCode = 'invalid';
                $this->failureMessage = 'is not a valid json string';
                return false;
            }
        }

        //Validate MATCH expression
        $match = $this->validation['match'];

        if ($match != null) {
            // Automatically escape unescaped slashes in the match before running it
            $match = preg_replace('/([^\\\\])\//', '$1\\/', $match);

            if (preg_match('/'.$match.'/s', $value) === 0) {
                $this->failureCode = 'invalid';
                //$this->failureMessage = 'is invalid (' . substr($value, 0, 255) . ')';
                $this->failureMessage = 'is invalid';
                return false;
            }
        }

        // Validate all custom functions
        foreach ( $this->validation['callback'] as $callback ) {
            if (!empty($callback) && call_user_func($callback, $value) === false) {
                $this->failureCode = $callback;
                $this->failureMessage = 'is invalid';
                return false;
            }
        }

        return true;
    }
1165669
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)
        {
            // First, we check whether we have a date instance so that
            // we take its string representation instead.
            if ($value instanceof DateTime || $value instanceof Carbon)
            {
                $value = $value->format($this->getDateFormat());
            }

            // 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);
    }
655628
protected function checkValidity($value) : bool
    {
        if ('' === $value) {
            return true;
        }
        $date = date_create($value);
        if (false === $date) {
            return false;
        }
        return true;
    }
1110226
public static function isOptionalExistingValue($value, array $values)
    {
        /* No additional validations when the value is null. */
        if (null === $value) {

            return true;
        }

        return self::isRequiredExistingValue($value, $values);
    }
939838
public static function empty(...$values): bool
    {
        self::handleInvalidArguments($values);

        foreach ($values as $value) {
            if (empty($value) === false) {
                return false;
            }
        }

        return true;
    }
1101849
public function matches(array $values, $strict = false)
    {
        if (empty($values)) {
            return false;
        }

        $claims = $this->getClaims();

        foreach ($values as $key => $value) {
            if (! $claims->has($key) || ! $claims->get($key)->matches($value, $strict)) {
                return false;
            }
        }

        return true;
    }
931876
protected function setValidation($values)
    {
        foreach ($values as $validation) {
            $value = isset($validation->value) ? $validation->value : true;

            $this->validation[$validation->rule] = $value;
        }
    }
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);
    }
12848
public function is(array $values, array $rules)
    {
        try {
            $this->execute($values, $rules);
        } catch (\Exception $ex) {
            return false;
        }

        return true;
    }
689506
public static function parseArray(array $values) {

        // Initialize the output.
        $output = [];

        // Handle each value.
        foreach ($values as $key => $value) {

            // Check if the value is null.
            if (null === $value) {
                continue;
            }

            // Check if the value is an array.
            if (true === is_array($value)) {
                $buffer = trim(implode(" ", $value));
            } else {
                $buffer = trim($value);
            }

            // Check if the buffer is not empty.
            if ("" !== $buffer) {
                $output[] = $key . "=\"" . preg_replace("/\s+/", " ", $buffer) . "\"";
            }
        }

        // Concatenates all attributes.
        return implode(" ", $output);
    }
886048
private function bindUntypedValues(array $values)
    {
        $params = [];
        $types  = str_repeat('s', count($values));

        foreach ($values as &$v) {
            $params[] =& $v;
        }

        return $this->_stmt->bind_param($types, ...$params);
    }