Skip to content

Commit 45d780b

Browse files
committed
Clean up install command failures
1 parent 791dbea commit 45d780b

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

src/Commands/InstallBinaryCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ protected function extract(string $archivePath, string $workingDirectory): void
104104
*/
105105
protected function install(string $workingDirectory, string $binaryPath): void
106106
{
107-
$source = $this->findExtractedBinary($workingDirectory);
108-
109-
if (is_null($source)) {
107+
if (! $source = $this->findExtractedBinary($workingDirectory)) {
110108
throw new RuntimeException('Unable to locate the privacy-filter binary in the extracted archive.');
111109
}
112110

@@ -168,7 +166,7 @@ protected function getArchiveFileName(string $url, string $fallback): string
168166
{
169167
$path = parse_url($url, PHP_URL_PATH);
170168

171-
if (! is_string($path) || $path === '') {
169+
if (! is_string($path) || empty($path)) {
172170
return $fallback;
173171
}
174172

src/Commands/InstallModelCommand.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,7 @@ public function handle(): int
4444
return self::SUCCESS;
4545
}
4646

47-
try {
48-
$this->download($url, $modelPath);
49-
} catch (RuntimeException $exception) {
50-
$this->error($exception->getMessage());
51-
52-
return self::FAILURE;
53-
}
47+
$this->download($url, $modelPath);
5448

5549
$this->info('Privacy-filter model installed.');
5650

0 commit comments

Comments
 (0)