This commit is contained in:
Dr Masroor Ehsan 2025-01-05 12:57:50 +06:00
parent 65a5b9971d
commit 6a6f63fa15
8 changed files with 14 additions and 10 deletions

View File

@ -22,7 +22,7 @@ public static function getLister(): IUserStudyLister
UserRole::Technician => new TechnicianWorklist,
UserRole::Radiologist => new RadiologistWorklist,
UserRole::ReferringDoctor => new ReferrerWorklist,
default => throw new Exception("Unknown user role: $role"),
default => throw new Exception("Unknown user role: {$role}"),
};
}
}

View File

@ -2,10 +2,10 @@
namespace App\Http\Controllers;
use function Sentry\captureException;
use Throwable;
use function Sentry\captureException;
abstract class HashidActionControllerBase extends Controller
{
protected ?int $key = null;

View File

@ -2,10 +2,10 @@
namespace App\Http\Controllers;
use function Sentry\captureException as gobble;
use Throwable;
use function Sentry\captureException as gobble;
abstract class HashidControllerBase extends Controller
{
protected ?int $key = null;

View File

@ -4,6 +4,7 @@
use App\Http\Controllers\HashidControllerBase;
use App\Models\Study;
use Closure;
use Illuminate\Support\Str;
class StudyViewerController extends HashidControllerBase
@ -18,7 +19,7 @@ public function ohif()
return $this->loadViewer(fn (Study $study) => $study->getOhifLink());
}
private function loadViewer(\Closure $callback)
private function loadViewer(Closure $callback)
{
$this->decodeKeys();
$study = Study::findOrFail($this->key);

View File

@ -12,7 +12,7 @@ class CustomPersonalAccessToken extends PersonalAccessToken
{
public static function findToken($token)
{
$token = Cache::remember("PersonalAccessToken::$token", 600,
$token = Cache::remember("PersonalAccessToken::{$token}", 600,
function () use ($token) {
return parent::findToken($token) ?? '_null_';
});

View File

@ -219,7 +219,7 @@ public function sanitizedStudyDescription(): string
'with' => 'w/',
];
foreach ($lut as $search => $replace) {
$name = preg_replace("/\b$search\b/i", $replace, $name);
$name = preg_replace("/\b{$search}\b/i", $replace, $name);
}
return $name;

View File

@ -4,6 +4,8 @@
use App\Models\Enums\NameMatchModes;
use function strlen;
final class InputMatcher
{
public static function match(string $input, string $pattern, NameMatchModes $mode): bool
@ -11,7 +13,7 @@ public static function match(string $input, string $pattern, NameMatchModes $mod
return match ($mode) {
NameMatchModes::Exact => strcasecmp($input, $pattern) === 0,
NameMatchModes::Contains => stripos($input, $pattern) !== false,
NameMatchModes::StartsWith => strncasecmp($input, $pattern, \strlen($pattern)) === 0,
NameMatchModes::StartsWith => strncasecmp($input, $pattern, strlen($pattern)) === 0,
NameMatchModes::EndsWith => str_ends_with(strtolower($input), strtolower($pattern)),
NameMatchModes::Regex => preg_match($pattern, $input) === 1,
};

View File

@ -7,6 +7,7 @@
use App\Services\Pacs\InstituteMapper;
use App\Services\Pacs\OrthancRestClient;
use Carbon\Carbon;
use Exception;
use Illuminate\Pipeline\Pipeline;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
@ -137,7 +138,7 @@ public function transformData(mixed $orthanc_src): array
if (filled($dob)) {
try {
$study['patient_birthdate'] = Carbon::parse($dob);
} catch (\Exception) {
} catch (Exception) {
Log::error('Failed to parse PatientMainDicomTags.PatientBirthDate: {dob}', ['dob' => $dob]);
}
}