src/Client/OAuthClient.php
public function unregisterMiddleware(IMiddleware $middleware): IOAuthClient
    {
        $middlewareClass = get_class($middleware);
        foreach ($middleware::statusCode() as $statusCode) {
            if (!isset($this->postRequestMiddlewares[$statusCode])) {
                continue;
            }
            $result = array_filter(
                $this->postRequestMiddlewares[$statusCode],
                function (IMiddleware $currMiddleware) use ($middlewareClass) {
                    return get_class($currMiddleware) != $middlewareClass;
                }
            );

            if (empty($result)) {
                unset($this->postRequestMiddlewares[$statusCode]);
            } else {
                $this->postRequestMiddlewares[$statusCode] = $result;
            }
        }

        return $this;
    }
public function unregisterMiddleware(IMiddleware $middleware): IOAuthClient
    {
        $middlewareClass = get_class($middleware);
        foreach ($middleware::statusCode() as $statusCode) {
            if (!isset($this->postRequestMiddlewares[$statusCode])) {
                continue;
            }
            $result = array_filter(
                $this->postRequestMiddlewares[$statusCode],
                function (IMiddleware $currMiddleware) use ($middlewareClass) {
                    return get_class($currMiddleware) != $middlewareClass;
                }
            );

            if (empty($result)) {
                unset($this->postRequestMiddlewares[$statusCode]);
            } else {
                $this->postRequestMiddlewares[$statusCode] = $result;
            }
        }

        return $this;
    }
public function unregisterMiddleware ( IMiddleware $ middleware ) : IOAuthClient { $ middlewareClass = get_class ( $ middleware ) ; foreach ( $ middleware :: statusCode ( ) as $ statusCode ) { if ( ! isset ( $ this -> postRequestMiddlewares [ $ statusCode ] ) ) { continue ; } $ result = array_filter ( $ this -> postRequestMiddlewares [ $ statusCode ] , function ( IMiddleware $ currMiddleware ) use ( $ middlewareClass ) { return get_class ( $ currMiddleware ) != $ middlewareClass ; } ) ; if ( empty ( $ result ) ) { unset ( $ this -> postRequestMiddlewares [ $ statusCode ] ) ; } else { $ this -> postRequestMiddlewares [ $ statusCode ] = $ result ; } } return $ this ; }
Unregister the middleware.

In fact, all middleware having the same class

@param \ZEROSPAM\Framework\SDK\Client\Middleware\IMiddleware $middleware

@return IOAuthClient
Unregister the middleware .