public static function ensureValid($option)
    {
        if (is_string($option)) {
            $option = strtolower($option);
        }

        if (!self::isValid($option)) {
            $option = is_scalar($option) ? $option : gettype($option);

            $parts = explode('\\', __CLASS__);
            $class = array_pop($parts);

            throw new EnumException(sprintf('"%s" is not a valid %s option.', $option, $class));
        }

        return $option;
    }