27 lines
583 B
PHP
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);
|
|
}
|
|
}
|