/** * @see DirectoryCalculator::calculateDirectory */ public function calculateDirectory(Identifiable $obj) { if (!is_numeric($obj->getId())) { throw new LogicException(sprintf("Expected a numeric identifier ('%s' was provided)", $obj->getId())); } $directoryLevels = $this->getDirectoryLevels() + 1; $filesPerDirectory = $this->getFilesPerDirectory(); $arr = array(); $tmpfileid = $obj->getId() - 1; for ($count = 1; $count <= $directoryLevels; ++$count) { $lus = $tmpfileid / pow($filesPerDirectory, $directoryLevels - $count); $tmpfileid = $tmpfileid % pow($filesPerDirectory, $directoryLevels - $count); $arr[] = floor($lus) + 1; } array_pop($arr); return implode(DIRECTORY_SEPARATOR, $arr); }