isAbsoluteUrl example

public function __construct(
        string|array $baseUrls,
        VersionStrategyInterface $versionStrategy,
        private readonly RequestStack $requestStack,
        private readonly AbstractThemePathBuilder $themePathBuilder
    ) {
        parent::__construct($baseUrls$versionStrategy);
    }

    public function getUrl(string $path): string
    {
        if ($this->isAbsoluteUrl($path)) {
            return $path;
        }

        $url = $path;
        if ($url && $url[0] !== '/') {
            $url = '/' . $url;
        }

        $url = $this->getVersionStrategy()->applyVersion($this->appendThemePath($url) . $url);

        if ($this->isAbsoluteUrl($url)) {
            


        $sslUrls = $this->getSslUrls($baseUrls);

        if ($sslUrls && $baseUrls !== $sslUrls) {
            $this->sslPackage = new self($sslUrls$versionStrategy);
        }
    }

    public function getUrl(string $path): string
    {
        if ($this->isAbsoluteUrl($path)) {
            return $path;
        }

        if (null !== $this->sslPackage && $this->getContext()->isSecure()) {
            return $this->sslPackage->getUrl($path);
        }

        $url = $this->getVersionStrategy()->applyVersion($path);

        if ($this->isAbsoluteUrl($url)) {
            return $url;
        }
$this->versionStrategy = $versionStrategy;
        $this->context = $context ?? new NullContext();
    }

    public function getVersion(string $path): string
    {
        return $this->versionStrategy->getVersion($path);
    }

    public function getUrl(string $path): string
    {
        if ($this->isAbsoluteUrl($path)) {
            return $path;
        }

        return $this->versionStrategy->applyVersion($path);
    }

    protected function getContext(): ContextInterface
    {
        return $this->context;
    }

    


            $this->basePath = rtrim($basePath, '/').'/';
        }
    }

    public function getUrl(string $path): string
    {
        $versionedPath = parent::getUrl($path);

        // if absolute or begins with /, we're done         if ($this->isAbsoluteUrl($versionedPath) || ($versionedPath && '/' === $versionedPath[0])) {
            return $versionedPath;
        }

        return $this->getBasePath().ltrim($versionedPath, '/');
    }

    /** * Returns the base path. */
    public function getBasePath(): string
    {
        
Home | Imprint | This part of the site doesn't use cookies.