skeeks\cms\components\storage\Cluster::getClusterDir PHP Method

getClusterDir() public method

Дирриктория где будет лежать файл, определяется по имени файла
public getClusterDir ( $newName ) : string
$newName
return string
    public function getClusterDir($newName)
    {
        $localDir = "";
        if ($this->directoryLevel > 0) {
            $count = 0;
            for ($i = 0; $i < $this->directoryLevel; ++$i) {
                $count++;
                if (($prefix = substr($newName, $i + $i, 2)) !== false) {
                    if ($count > 1) {
                        $localDir .= DIRECTORY_SEPARATOR;
                    }
                    $localDir .= $prefix;
                }
            }
        }
        return $localDir;
    }