/** * @param FileInfo $srcFileInfo The source FileInfo * * @return FileInfo The destination FileInfo * * @throws \RuntimeException If specified naming strategy returns not FileNamingResolver\FileInfo instance */ public function resolve(FileInfo $srcFileInfo) { $dstFileInfo = $this->namingStrategy->provideName($srcFileInfo); if (!$dstFileInfo instanceof FileInfo) { throw new \RuntimeException(sprintf('Specified naming strategy should return an instance of "%s" class', '\\FileNamingResolver\\FileInfo')); } return $dstFileInfo; }
/** * @param FileInfo $srcFileInfo * @return string */ public function resolveName(FileInfo $srcFileInfo) { return (string) $this->namingStrategy->provideName($srcFileInfo); }