ChooseBaseUrl should return an index

Enforce chooseBaseUrl to return an integer index to the baseUrls member.
This commit is contained in:
Benoît Burnichon 2016-01-14 14:25:27 +01:00 committed by Benoît Burnichon
parent 07673dcd38
commit 0d041c3f8a

View File

@ -108,15 +108,15 @@ class UrlPackage extends Package
* Determines which base URL to use for the given path. * Determines which base URL to use for the given path.
* *
* Override this method to change the default distribution strategy. * Override this method to change the default distribution strategy.
* This method should always return the same base URL for a given path. * This method should always return the same base URL index for a given path.
* *
* @param string $path * @param string $path
* *
* @return string The base URL for the given path * @return int The base URL index for the given path
*/ */
protected function chooseBaseUrl($path) protected function chooseBaseUrl($path)
{ {
return fmod(hexdec(substr(hash('sha256', $path), 0, 10)), count($this->baseUrls)); return (int) fmod(hexdec(substr(hash('sha256', $path), 0, 10)), count($this->baseUrls));
} }
private function getSslUrls($urls) private function getSslUrls($urls)