src/Viserio/Component/Routing/PendingResourceRegistration.php
private function validateGivenMiddleware($middleware): void
    {
        $this->validateInput($middleware);

        if (\is_array($middleware)) {
            foreach ($middleware as $mw) {
                $this->validateMiddleware($mw);
            }
        } else {
            $this->validateMiddleware($middleware);
        }
    }
private function validateGivenMiddleware($middleware): void
    {
        $this->validateInput($middleware);

        if (\is_array($middleware)) {
            foreach ($middleware as $mw) {
                $this->validateMiddleware($mw);
            }
        } else {
            $this->validateMiddleware($middleware);
        }
    }
First:  Validates the given input.
Second: Checks if given middleware or list of middleware have the right interface.

@param array|object|string $middleware

@throws \RuntimeException if wrong input is given
@throws \LogicException   if \Psr\Http\Server\MiddlewareInterface was not found

@return void