radfusion/app/Services/Pacs/Sync/Pipes/ScanStudies.php
2025-01-28 23:39:57 +06:00

27 lines
583 B
PHP

<?php
namespace App\Services\Pacs\Sync\Pipes;
use App\Services\Pacs\Sync\StudiesSync;
use Closure;
use Exception;
use Illuminate\Support\Facades\Log;
final readonly class ScanStudies
{
public function __invoke(StudiesSync $sync, Closure $next): StudiesSync
{
$study_ids = [];
try {
$study_ids = $sync->getClient()->getStudiesIds();
} catch (Exception $e) {
Log::error($e->getMessage());
}
if (! empty($study_ids)) {
$sync->setStudyIds($study_ids);
}
return $next($sync);
}
}