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;
    }