Refactor helper drift in lib: centralize theme/translation and remove app() hotspots

This commit is contained in:
2026-03-19 08:23:14 +01:00
parent 5da506a20f
commit 5739cc1200
24 changed files with 197 additions and 88 deletions

View File

@@ -4,9 +4,12 @@ namespace MintyPHP\Service\Scheduler;
use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
use MintyPHP\Service\I18n\TranslatesServiceText;
class ScheduledJobService
{
use TranslatesServiceText;
private const RUN_RETENTION_DAYS = 90;
public function __construct(
@@ -280,14 +283,4 @@ class ScheduledJobService
};
}
private function translate(string $text, mixed ...$args): string
{
if (function_exists('t')) {
return t($text, ...$args);
}
if ($args === []) {
return $text;
}
return vsprintf($text, array_map(static fn ($arg) => (string) $arg, $args));
}
}