public function validate($value, &$filtered = null)
    {
        $this->error = null;

        if ($value === null)
            return $this->options['nullable'] ?? false;
        
        $filtered = $value;
        if ($this->type === Validator::EXISTS)
            return true;
        
        $o = $this->options;
        if ($this->type !== Validator::VALIDATE_CUSTOM && !$this->matchType($value, $filtered))
            return false;

        if (isset($o['custom']) && is_callable($o['custom']))
        {
            try
            {
                $valid = $o['custom']($value);
                if (!is_bool($valid))
                    throw new \RuntimeException("Validator did not return boolean: " . WF::str($valid));
            }
            catch (ValidationException $e)
            {
                $this->error = $e->getError();
                $valid = false;
            }
            return $valid;
        }

        return true;
    }