buildCommand($command, $path); $process = new Process($command); $process->run(); if ($process->isSuccessful()) { return UploadScanResult::clean(); } if ($process->getExitCode() === 1) { return UploadScanResult::infected(trim($process->getOutput())); } throw new RuntimeException('Upload scan failed: ' . trim($process->getErrorOutput())); } private function buildCommand(array $command, string $path): array { return array_map(static function (string $part) use ($path): string { return $part === '{path}' ? $path : $part; }, $command); } }