@param $value
@param IValidationData $data

@return bool
346728
public function check($value, IValidationData $data = null) {
        if (is_string($value)) {
            return filter_var($value, FILTER_VALIDATE_EMAIL) !== false;
        }
        return false;
    }
1033112
public function check($value, IValidationData $data = null) {
        if (is_scalar($value)) {
            return preg_match('/^[[:alnum:]]+$/u', $value) === 1;
        }

        return false;
    }
746097
public function setValue($value, $data = null)
    {
        // Define Value Property:
        
        $this->value = $value;
        
        // Determine Value Type:
        
        if (is_array($value)) {
            
            // Define from Array:
            
            foreach ($this->getViewports() as $viewport) {
                
                $field = $this->getViewportField($viewport);
                
                if (isset($value[$viewport])) {
                    $field->setValue($value[$viewport]);
                }
                
            }
            
        } elseif ($value instanceof DBViewports) {
            
            // Define from Field:
            
            foreach ($this->getViewports() as $viewport) {
                $this->getViewportField($viewport)->setValue($value->{$viewport});
            }
            
        }
        
        // Answer Receiver:
        
        return $this;
    }
620568
public static function register($key, $value, $data = [])
    {
        if (!self::_tableExists()) {
            return;
        }

        self::autoLoad();

        $_data = [
            'value' => $value,
            'editable' => 1,
            'autoload' => true,
            'options' => [],
            'description' => null,
        ];

        $data = array_merge($_data, $data);

        // Don't overrule because we register
        $data['overrule'] = false;

        self::options($key, $data['options']);

        self::write($key, $data['value'], $data);
    }
19896
public function check($value, IValidationData $data = null) {
        if (is_string($value)) {
            $value = trim($value);
        }

        return ! empty($value);
    }
502696
public function _isValueIndexable($value)
    {
        return (
            is_string($value)
            || is_null($value)
            || is_bool($value)
            || is_integer($value)
        );
    }
906948
public function check($value, IValidationData $data = null) {
        if (is_string($value)) {
            $length = strlen($value);

            return $length >= $this->min && $length <= $this->max;
        }

        return false;
    }
973655
protected function requireWith($value, $rule, $data)
    {
        $val = $this->getDataValue($data, $rule);
        if (!empty($val))
        {
            return !empty($value) || '0' == $value;
        }
        else
        {
            return true;
        }
    }
943142
public function check($value, IValidationData $data = null) {
        if (is_string($value)) {
            return strlen($value) <= $this->max;
        } else if (is_array($value)) {
            return count($value) <= $this->max;
        }

        return false;
    }
720834
public function assign($data, $value = null) {
        if (is_array($data)) {
            $this->data = array_merge($this->data, $data);
        } else if ($data) {
            $this->data [ $data ] = $value;
        }

        return $this;
    }
1111440
public function setData($Data)
    {
        if (! is_object($Data) || ! $Data instanceof Data) {
            throw new \InvalidArgumentException(
                'The Data Interface must be a valid Data Object'
            );
        }
        $this->Data = $Data;

        return true;
    }
1321219
public static function isValid($value)
    {
        if($value === null){
            return false;
        }

        $reflection = new \ReflectionClass(get_called_class());
        return in_array($value, $reflection->getConstants());
    }
46518
public function setValue($value, $data = null)
    {
        // If $data is a DataObject, don't use the value, since it's a hashed value
        if ($data && $data instanceof DataObject) {
            $value = '';
        }

        //store this for later
        $oldValue = $this->value;

        if (is_array($value)) {
            $this->value = $value['_Password'];
            $this->confirmValue = $value['_ConfirmPassword'];
            $this->currentPasswordValue = ($this->getRequireExistingPassword() && isset($value['_CurrentPassword']))
                ? $value['_CurrentPassword']
                : null;

            if ($this->showOnClick && isset($value['_PasswordFieldVisible'])) {
                $this->getChildren()->fieldByName($this->getName() . '[_PasswordFieldVisible]')
                    ->setValue($value['_PasswordFieldVisible']);
            }
        } else {
            if ($value || (!$value && $this->canBeEmpty)) {
                $this->value = $value;
                $this->confirmValue = $value;
            }
        }

        //looking up field by name is expensive, so lets check it needs to change
        if ($oldValue != $this->value) {
            $this->getChildren()->fieldByName($this->getName() . '[_Password]')
                ->setValue($this->value);

            $this->getChildren()->fieldByName($this->getName() . '[_ConfirmPassword]')
                ->setValue($this->confirmValue);
        }

        return $this;
    }
1365193
public function check($value, IValidationData $data = null) {
        if (is_string($value)) {
            return preg_match($this->pattern, $value) === 1;
        }

        return false;
    }
1000801
public function isValueValid($value) {
		return $value instanceof Type\Distance || $value instanceof DataType\NumberType || $value instanceof DataType\TextType;
	}
614566
public function hasDataKey($path=null, &$value=null) {
		$v = $this->getData($path);
		if( !$v || !is_array($v) ) { return false; }
		$value = key($v);
		return true;
	}
1331881
public function validate(ValidationData $data)
    {
        foreach ($this->getValidatableClaims() as $claim) {
            if (!$claim->validate($data)) {
                return false;
            }
        }

        return true;
    }