FileNamingResolver\NamingStrategy\AbstractHashNamingStrategy::provideNameByHash PHP Method

provideNameByHash() public method

public provideNameByHash ( FileInfo $srcFileInfo, string $hash ) : FileInfo
$srcFileInfo FileNamingResolver\FileInfo
$hash string
return FileNamingResolver\FileInfo
    public function provideNameByHash(FileInfo $srcFileInfo, $hash)
    {
        $pathSuffixParts = array();
        for ($i = 0; $i < $this->partCount; $i++) {
            $pathSuffixParts[] = substr($hash, $i * $this->partLength, $this->partLength);
        }
        $name = substr($hash, $i * $this->partLength);
        $pathSuffix = implode(FileInfo::SEPARATOR_DIRECTORY, $pathSuffixParts);
        $dstFileInfo = $srcFileInfo->changeBasename($name)->changePath($srcFileInfo->getPath() . FileInfo::SEPARATOR_DIRECTORY . $pathSuffix);
        return $dstFileInfo;
    }