chooseBaseUrl example



    /** * Returns the base URL for a path. */
    public function getBaseUrl(string $path): string
    {
        if (1 === \count($this->baseUrls)) {
            return $this->baseUrls[0];
        }

        return $this->baseUrls[$this->chooseBaseUrl($path)];
    }

    /** * Determines which base URL to use for the given path. * * Override this method to change the default distribution strategy. * This method should always return the same base URL index for a given path. */
    protected function chooseBaseUrl(string $path): int
    {
        return abs(crc32($path)) % \count($this->baseUrls);
    }
Home | Imprint | This part of the site doesn't use cookies.