request = $request; $this->translator = $translator; $this->baseUrl = $baseUrl ?? $request->getBaseUrl(); } public function getBaseUrl(string $path = '', array $data = [], ?string $locale = null): string { $overrideLocale = $locale ?? $this->translator->getLocale(); $localePrefix = ($overrideLocale != $this->translator->getDefaultLocale()) ? $overrideLocale . DIRECTORY_SEPARATOR : ''; $url = $this->baseUrl . $localePrefix . ($path ? DIRECTORY_SEPARATOR.$path : ''); //Attach data as a query string. if(!empty($data)) { } return $url; } public function getUrl(string $path = '', array $data = [], ?string $locale = null): string { return $this->getBaseUrl($path, $data, $locale); } public function getStorageUrl(string $path = '', array $data = [], ?string $locale = null): string { return ''; } public function getAssetUrl(string $path = '', array $data = [], ?string $locale = null): string { return ''; } public function getRouteUrl(string $route = '', array $data = [], ?string $locale = null): string { return ''; } public function setRoutes(array $routes): bool { if(!empty($this->routes)) { $this->routes = $routes; return true; } return false; } }