src/Application/App.php
public function pipe($path, $middlewares = null, string $env = null): self
    {
        if (null !== $env && $this->env !== $env) {
            return $this;
        }

        if (null === $middlewares) {
            $middlewares = $this->buildMiddleware($path);
            $path = '*';
        }

        if (!$middlewares instanceof MiddlewareInterface) {
            $middlewares = $this->buildMiddleware($middlewares);
        }

        $route = new Route($path, $middlewares);

        $this->dispatcher->pipe($route);

        $this->log(
            $this->container,
            sprintf(
                'App::pipe - Pipe middleware %s %s - %s',
                implode(',', $route->getMethod()),
                $route->getPath(),
                get_class($middlewares)
            )
        );

        return $this;
    }
public function pipe($path, $middlewares = null, string $env = null): self
    {
        if (null !== $env && $this->env !== $env) {
            return $this;
        }

        if (null === $middlewares) {
            $middlewares = $this->buildMiddleware($path);
            $path = '*';
        }

        if (!$middlewares instanceof MiddlewareInterface) {
            $middlewares = $this->buildMiddleware($middlewares);
        }

        $route = new Route($path, $middlewares);

        $this->dispatcher->pipe($route);

        $this->log(
            $this->container,
            sprintf(
                'App::pipe - Pipe middleware %s %s - %s',
                implode(',', $route->getMethod()),
                $route->getPath(),
                get_class($middlewares)
            )
        );

        return $this;
    }
Add middleware on pipe.

@param $path
@param null        $middlewares
@param string|null $env

@return App

@internal param bool $first