public function check($input)
    {
        $this->lastValue = $input;
        $anyFailed = false;
        foreach ($this->rules as $ruleName => &$rule) {

            // at least OK
            if ($rule->check($input)) {

                // stop here if any is OK or rule is sufficient
                if ($this->matchAny || $rule->isSufficient()) {
                    return true;
                }
            }

            // if not in match any mode -> first fail stops
            elseif (!$this->matchAny) {
                $this->failedRule = &$rule;
                return false;
            }

            // at least one failed
            else {
                if (!$anyFailed) {
                    $this->failedRule = &$rule;
                }
                $anyFailed = true;
            }
        }

        // all have to work out!
        return !$anyFailed;
    }