Payment/Model/PaymentStates.php
static public function isValidState($state, $throwException = true)
    {
        if (in_array($state, static::getStates(), true)) {
            return true;
        }

        if ($throwException) {
            throw new InvalidArgumentException("Invalid payment states '$state'.");
        }

        return false;
    }
static public function isValidState($state, $throwException = true)
    {
        if (in_array($state, static::getStates(), true)) {
            return true;
        }

        if ($throwException) {
            throw new InvalidArgumentException("Invalid payment states '$state'.");
        }

        return false;
    }
Returns whether or not the given state is valid.

@param string $state
@param bool   $throwException

@return bool