Register the given middleware.

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

@return IOAuthClient
424479
public function registerMiddleware(IMiddleware $middleware): IOAuthClient
    {
        $middleware->setClient($this);
        foreach ($middleware::statusCode() as $statusCode) {
            $this->postRequestMiddlewares[$statusCode][] = $middleware;
        }

        return $this;
    }
1336510
public function registerMiddleware()
    {
        if (is_array($this->middleware()) && count($this->middleware()))
        {
            $middleware = new Middleware($this);
            return $middleware->add();
        }
        return true;
    }
605879
public function addMiddleware(callable $middleware, string $type = self::BEFORE)
  {
;    $type = self::validateMiddlewareType($type);
    $this->middlewares[$type][] = $middleware;
  }
1098161
public function middleware(...$middlewares) 
	{
		foreach ($middlewares as $middleware) {
			$this->currentContext->addMiddleware($middleware);
		}

		return $this;
	}
451750
protected function registerMiddleware()
    {
        $this->app->bind('tactician.middleware', function() {
            $middleware = $this->config('middleware');
            $resolved   = array_map(function($name) {
                if (is_string($name)) {
                    return $this->app->make($name);
                }
                return $name;
            }, $middleware);

            $resolved[] = $this->app['tactician.handler'];

            return $resolved;
        });
    }
1364559
public function withMiddleware($middleware = null)
    {
        if (is_null($middleware)) {
            unset($this->app['middleware.disable']);

            return $this;
        }

        foreach ((array) $middleware as $abstract) {
            unset($this->app[$abstract]);
        }

        return $this;
    }
978820
public function pushMiddleware(array $middlewares)
    {
        foreach ($middlewares as $key => $middleware) {
            $this->middlewares[$key] = $middleware;
        }
    }
1288999
public function addMiddleware(string $name, MiddlewareInterface $middleware): self
    {
        $this->container[$name] = $middleware;
        array_unshift($this->middleware, $name);

        return $this;
    }
630640
public function middleware( $middleware, array $options = [] )
	{
		foreach ( (array) $middleware as $middlewareName )
			$this->middleware[$middlewareName] = &$options;

		return new ControllerMiddlewareOptions( $options );
	}
830586
public function registerMiddleware(Router $router)
    {
        foreach ($this->middleware as $module => $middlewares) {
            foreach ($middlewares as $name => $middleware) {
                $class = "Modules\\{$module}\\Http\\Middleware\\{$middleware}";

                $router->middleware($name, $class);
            }
        }
    }
721246
public function prependMiddleware($middleware)
    {
        if (array_search($middleware, $this->middleware) === false) {
            array_unshift($this->middleware, $middleware);
        }

        return $this;
    }
390228
public function middleware($middleware)
    {
        $middleware = (array) $middleware;

        if (! is_array($this->cb)) {
            $this->cb = [
                'controller' => $this->cb,
                'middleware' => $middleware
            ];

            return $this;
        }


        if (!isset($this->cb['middleware'])) {
            $this->cb['middleware'] = $middleware;
        } else {
            $this->cb['middleware'] = array_merge($middleware, (array) $this->cb['middleware']);
        }

        return $this;
    }
423760
private function registerRoutesAndMiddlewares()
    {
        /**
         * @var Router $router
         */
        $router = $this->app[ 'router' ];

        $router->middlewareGroup( 'admin', [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
            ArboryAdminHasAllowedIpMiddleware::class
        ] );

        $router->aliasMiddleware( 'arbory.admin_auth', ArboryAdminAuthMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_module_access', ArboryAdminModuleAccessMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_quest', ArboryAdminGuestMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_in_role', ArboryAdminInRoleMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_has_access', ArboryAdminHasAccessMiddleware::class );
        $router->aliasMiddleware( 'arbory.route_redirect', ArboryRouteRedirectMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_has_allowed_ip', ArboryAdminHasAllowedIpMiddleware::class );

        $this->app->booted( function( $app )
        {
            $app[ Kernel::class ]->prependMiddleware( ArboryRouteRedirectMiddleware::class );
        } );

        $this->registerAdminRoutes();
        $this->registerAppRoutes();
    }
328303
public function add(...$middleware) : self
    {
        foreach ($middleware as $m) {
            if ($m instanceof TusMiddleware) {
                $this->globalMiddleware[get_class($m)] = $m;
            } elseif (is_string($m)) {
                $this->globalMiddleware[$m] = new $m;
            }
        }

        return $this;
    }
1172263
protected function registerApiRouteMiddleware()
    {
        foreach ($this->getApiRouteMiddleware() as $key => $middleware) {
            $this->router->aliasMiddleware($key, $middleware);
        }

        return $this;
    }
629313
protected function registerCmsWebGroupMiddleware()
    {
        $this->router->middlewareGroup($this->getConfiguredWebGroupName(), []);

        foreach ($this->getGlobalWebMiddleware() as $middleware) {

            // Don't add if the middleware is already globally enabled in the kernel
            if ($this->kernel->hasMiddleware($middleware)) {
                // @codeCoverageIgnoreStart
                continue;
                // @codeCoverageIgnoreEnd
            }

            $this->router->pushMiddlewareToGroup($this->getConfiguredWebGroupName(), $middleware);
        }

        return $this;
    }
497776
protected function registerMiddleware($router)
    {
        if (method_exists($router, 'aliasMiddleware')) {
            $router->aliasMiddleware('site', CurrentSite::class);
        } else {
            $router->middleware('site', CurrentSite::class);
        }
    }