style: Pint 포맷팅 적용
This commit is contained in:
@@ -16,7 +16,7 @@ class DocxToPdfConverter
|
||||
*/
|
||||
public function convertAndStore(UploadedFile $file, string $storagePath): array
|
||||
{
|
||||
if (!$this->isWordFile($file)) {
|
||||
if (! $this->isWordFile($file)) {
|
||||
// PDF는 그대로 저장
|
||||
$path = $file->store($storagePath, 'local');
|
||||
|
||||
@@ -32,11 +32,11 @@ public function convertAndStore(UploadedFile $file, string $storagePath): array
|
||||
$originalName = $file->getClientOriginalName();
|
||||
$pdfName = preg_replace('/\.(docx?|DOCX?)$/', '.pdf', $originalName);
|
||||
|
||||
$tmpDir = sys_get_temp_dir() . '/esign_convert_' . Str::random(16);
|
||||
$tmpDir = sys_get_temp_dir().'/esign_convert_'.Str::random(16);
|
||||
mkdir($tmpDir, 0755, true);
|
||||
|
||||
try {
|
||||
$tmpWordPath = $tmpDir . '/' . 'source.' . $file->getClientOriginalExtension();
|
||||
$tmpWordPath = $tmpDir.'/'.'source.'.$file->getClientOriginalExtension();
|
||||
copy($file->getRealPath(), $tmpWordPath);
|
||||
|
||||
$command = sprintf(
|
||||
@@ -50,12 +50,12 @@ public function convertAndStore(UploadedFile $file, string $storagePath): array
|
||||
|
||||
if ($exitCode !== 0) {
|
||||
throw new RuntimeException(
|
||||
'LibreOffice 변환 실패 (exit code: ' . $exitCode . '): ' . implode("\n", $output)
|
||||
'LibreOffice 변환 실패 (exit code: '.$exitCode.'): '.implode("\n", $output)
|
||||
);
|
||||
}
|
||||
|
||||
$tmpPdfPath = $tmpDir . '/source.pdf';
|
||||
if (!file_exists($tmpPdfPath)) {
|
||||
$tmpPdfPath = $tmpDir.'/source.pdf';
|
||||
if (! file_exists($tmpPdfPath)) {
|
||||
throw new RuntimeException('변환된 PDF 파일을 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public function convertAndStore(UploadedFile $file, string $storagePath): array
|
||||
$size = filesize($tmpPdfPath);
|
||||
|
||||
// 최종 저장 경로
|
||||
$finalPath = $storagePath . '/' . Str::random(40) . '.pdf';
|
||||
$finalPath = $storagePath.'/'.Str::random(40).'.pdf';
|
||||
Storage::disk('local')->put($finalPath, file_get_contents($tmpPdfPath));
|
||||
|
||||
return [
|
||||
@@ -74,7 +74,7 @@ public function convertAndStore(UploadedFile $file, string $storagePath): array
|
||||
];
|
||||
} finally {
|
||||
// 임시 파일 정리
|
||||
array_map('unlink', glob($tmpDir . '/*'));
|
||||
array_map('unlink', glob($tmpDir.'/*'));
|
||||
@rmdir($tmpDir);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user