src/Bootstrap.php
public function addMiddleware(...$middleware)
    {
        foreach ($middleware as $mw) {
            if (is_callable($mw)) {
                $this->app->add($mw);
            } elseif (is_string($mw)) {
                $class = $mw;
                $callable = new $class($this->getContainer());
                $this->app->add($callable);
            } else {
                throw new \InvalidArgumentException('Unsupported type for the middleware');
            }
        }

        return $this;
    }
public function addMiddleware(...$middleware)
    {
        foreach ($middleware as $mw) {
            if (is_callable($mw)) {
                $this->app->add($mw);
            } elseif (is_string($mw)) {
                $class = $mw;
                $callable = new $class($this->getContainer());
                $this->app->add($callable);
            } else {
                throw new \InvalidArgumentException('Unsupported type for the middleware');
            }
        }

        return $this;
    }
public function addMiddleware ( ... $ middleware ) { foreach ( $ middleware as $ mw ) { if ( is_callable ( $ mw ) ) { $ this -> app -> add ( $ mw ) ; } elseif ( is_string ( $ mw ) ) { $ class = $ mw ; $ callable = new $ class ( $ this -> getContainer ( ) ) ; $ this -> app -> add ( $ callable ) ; } else { throw new \ InvalidArgumentException ( 'Unsupported type for the middleware' ) ; } } return $ this ; }
Add application middleware
The only requirement: $middleware can be a callable or a string for a class name.
A $middleware may not be necessarily an instance of Kod\BootstrapSlim\Middleware.

@param array ...$middleware
@return static
@throws \InvalidArgumentException
Add application middleware The only requirement : $middleware can be a callable or a string for a class name . A $middleware may not be necessarily an instance of Kod \ BootstrapSlim \ Middleware .