src/Helpers/Url.php
protected static function getCurrentPath(RequestApplicationInterface $app, $onlyStaticPart = false) {
        $route = $app->getRoute();
        return $route ? $route->getRoutePath($onlyStaticPart) : null;
    }
protected static function getCurrentPath(RequestApplicationInterface $app, $onlyStaticPart = false) {
        $route = $app->getRoute();
        return $route ? $route->getRoutePath($onlyStaticPart) : null;
    }
Get current path from request & current controller
@param RequestApplicationInterface $app
@param bool                $onlyStaticPart
@return null|string