Transformer/ConditionTrait.php
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;
    }
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;
    }
Softly check if an input key match a value, or not

@param object|array $input
@param string       $key
@param mixed        $value
@param bool         $shouldMatch
@param bool         $regexpMode

@throws \Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException
@throws \Symfony\Component\PropertyAccess\Exception\AccessException
@throws \Symfony\Component\PropertyAccess\Exception\InvalidArgumentException

@return bool