compilationDataReader = $compilationDataReader; $this->compilationDataWriter = $compilationDataWriter; } /** * @param File $file * @param tao_models_classes_service_StorageDirectory $directory * @return File * @throws common_Exception */ public function convert(File $file, tao_models_classes_service_StorageDirectory $directory) { $fileName = pathinfo($file->getBasename(), PATHINFO_FILENAME); $resultFile = $this->getNewFile($directory, $fileName); $object = $this->compilationDataReader->readCompilationData($directory, $fileName); $this->compilationDataWriter->writeCompilationData($directory, $fileName, $object); return $resultFile; } /** * @param tao_models_classes_service_StorageDirectory $directory * @param string $outputFileName * @return File */ private function getNewFile(tao_models_classes_service_StorageDirectory $directory, $outputFileName) { $outputFileName .= '.' . $this->compilationDataWriter->getOutputFileType(); $resultFile = $directory->getFile($outputFileName); if ($resultFile->exists()) { $resultFile->delete(); } return $resultFile; } }