src/Robin/Ntlm/Crypt/Exception/CryptographicFailureException.php
public static function forReasonCode($code = 0, Exception $previous = null)
    {
        switch ($code) {
            case self::CODE_FOR_ENCRYPTION_FAILURE:
                $message = self::MESSAGE_FOR_ENCRYPTION_FAILURE;
                break;
            case self::CODE_FOR_RANDOM_DATA_GENERATION_FAILURE:
                $message = self::MESSAGE_FOR_RANDOM_DATA_GENERATION_FAILURE;
                break;
            default:
                $message = self::DEFAULT_MESSAGE;
        }

        return new static($message, $code, $previous);
    }
public static function forReasonCode($code = 0, Exception $previous = null)
    {
        switch ($code) {
            case self::CODE_FOR_ENCRYPTION_FAILURE:
                $message = self::MESSAGE_FOR_ENCRYPTION_FAILURE;
                break;
            case self::CODE_FOR_RANDOM_DATA_GENERATION_FAILURE:
                $message = self::MESSAGE_FOR_RANDOM_DATA_GENERATION_FAILURE;
                break;
            default:
                $message = self::DEFAULT_MESSAGE;
        }

        return new static($message, $code, $previous);
    }
Creates an exception instance for a given reason code.

This automatically maps a reason message to the given reason code.

@param int $code The exception/reason code.
@param Exception|null $previous A previous exception used for chaining.
@return static