FileNamingResolver\FileInfo::changePath PHP Method

changePath() public method

Changes directory path to the file / directory.
public changePath ( string $path ) : FileInfo
$path string
return FileInfo
    public function changePath($path)
    {
        $pathname = $this->createPathname($path, $this->getBasename(), $this->getExtension());
        return new static($pathname);
    }

Usage Example

 /**
  * {@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;
 }
All Usage Examples Of FileNamingResolver\FileInfo::changePath