Refactor helper drift in lib: centralize theme/translation and remove app() hotspots
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user