<?php

namespace Fifa\ConnectId\Sdk\Exception;

use BadMethodCallException;

/**
 * Class AsyncCallNotSupportedException
 * @package Fifa\ConnectId\Sdk\Exception
 */
class AsyncCallNotSupportedException extends BadMethodCallException
{
    /**
     * @var string
     */
    const METHOD_NOT_ALLOWED_MESSAGE = 'It is not possible to run method "%s" in asynchronous mode.';

    /**
     * @param string $methodName
     * @return AsyncCallNotSupportedException
     */
    public static function methodNotAllowed(string $methodName): AsyncCallNotSupportedException
    {
        $message = sprintf(self::METHOD_NOT_ALLOWED_MESSAGE, $methodName);
        return new self($message);
    }
}