public function wrap($callable, $params = [])
    {
        $kernel = new ClosureHttpKernel();

        if (is_callable($callable)) {
            $middleware = $callable($kernel);
        } else {
            // Add kernel as 'app' parameter
            $params = ['app' => $kernel] + $params;
            $makeMethod = method_exists($this->container, 'makeWith') ?  'makeWith' : 'make';
            $middleware = $this->container->$makeMethod($callable, $params);
        }

        if ($middleware instanceof TerminableInterface) {
            return new TerminableClosureMiddleware($kernel, $middleware);
        }

        return new ClosureMiddleware($kernel, $middleware);
    }
public function wrap($callable, $params = [])
    {
        $kernel = new ClosureHttpKernel();

        if (is_callable($callable)) {
            $middleware = $callable($kernel);
        } else {
            // Add kernel as 'app' parameter
            $params = ['app' => $kernel] + $params;
            $makeMethod = method_exists($this->container, 'makeWith') ?  'makeWith' : 'make';
            $middleware = $this->container->$makeMethod($callable, $params);
        }

        if ($middleware instanceof TerminableInterface) {
            return new TerminableClosureMiddleware($kernel, $middleware);
        }

        return new ClosureMiddleware($kernel, $middleware);
    }
public function wrap ( $ callable , $ params = [ ] ) { $ kernel = new ClosureHttpKernel ( ) ; if ( is_callable ( $ callable ) ) { $ middleware = $ callable ( $ kernel ) ; } else { // Add kernel as 'app' parameter $ params = [ 'app' => $ kernel ] + $ params ; $ makeMethod = method_exists ( $ this -> container , 'makeWith' ) ? 'makeWith' : 'make' ; $ middleware = $ this -> container -> $ makeMethod ( $ callable , $ params ) ; } if ( $ middleware instanceof TerminableInterface ) { return new TerminableClosureMiddleware ( $ kernel , $ middleware ) ; } return new ClosureMiddleware ( $ kernel , $ middleware ) ; }
Wrap the StackPHP Middleware in a Laravel Middleware.

@param  callable|string $callable
@param  array           $params

@return ClosureMiddleware
Wrap the StackPHP Middleware in a Laravel Middleware .