Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit c42b8a9

Browse files
authored
Added try-finally
1 parent f4288fa commit c42b8a9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Services/BingAds/ReportDownload.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,12 @@ protected function extractZip($location, $name)
133133
// if this occurs we will just remove it.
134134
$fileNameLength = strpos($name, '_') > 0 ? strpos($name, '_') : strlen($name);
135135
$filePath = storage_path('app/') . substr($name, 0, $fileNameLength) . '.csv';
136-
137-
$data = file($filePath);
138-
unlink($filePath);
136+
137+
try {
138+
$data = file($filePath);
139+
} finally {
140+
unlink($filePath);
141+
}
139142

140143
return $data;
141144
}

0 commit comments

Comments
 (0)