/** * {@inheritdoc} */ public function provideName(FileInfo $srcFileInfo) { $datetime = \DateTime::createFromFormat('U.u', microtime(true)); $pathSuffix = FileInfo::purifyPath($datetime->format($this->dirFormat)); $dstFileInfo = $srcFileInfo->changePath($srcFileInfo->getPath() . FileInfo::SEPARATOR_DIRECTORY . $pathSuffix)->changeBasename($datetime->format($this->fileFormat)); return $dstFileInfo; }
public function testPurifyPath() { $path = ' /var/www/html/ '; $this->assertEquals('/var/www/html', FileInfo::purifyPath($path)); }