protected function checkValue($input, $key, $value, $shouldMatch = true, $regexpMode = false)
    {
        $currentValue = $this->getValue($input, $key);

        /** @noinspection TypeUnsafeComparisonInspection */
        if ($shouldMatch && !$regexpMode && $currentValue != $value) {
            return false;
        }

        /** @noinspection TypeUnsafeComparisonInspection */
        if (!$shouldMatch && !$regexpMode && $currentValue == $value) {
            return false;
        }

        if ($regexpMode) {
            $pregMatch = preg_match($value, $currentValue);

            if ($shouldMatch && (false === $pregMatch || 0 === $pregMatch)) {
                return false;
            }

            if (!$shouldMatch && (false === $pregMatch || $pregMatch > 0)) {
                return false;
            }
        }

        return true;
    }