Refactor helper drift in lib: centralize theme/translation and remove app() hotspots
This commit is contained in:
@@ -5,6 +5,7 @@ namespace MintyPHP\Service\Import;
|
||||
use MintyPHP\Http\SessionStoreInterface;
|
||||
use MintyPHP\Service\Access\PermissionService;
|
||||
use MintyPHP\Service\Audit\ImportAuditService;
|
||||
use MintyPHP\Service\I18n\TranslatesServiceText;
|
||||
use MintyPHP\Service\Import\Profile\ImportProfileInterface;
|
||||
use MintyPHP\Service\Settings\SettingsDefaultsGateway;
|
||||
use MintyPHP\Service\Tenant\TenantScopeService;
|
||||
@@ -28,6 +29,8 @@ use MintyPHP\Service\Tenant\TenantScopeService;
|
||||
*/
|
||||
class ImportService
|
||||
{
|
||||
use TranslatesServiceText;
|
||||
|
||||
private const MAX_ROWS = 20000;
|
||||
private const MAX_ERROR_ROWS = 500;
|
||||
private const PROFILE_PERMISSION_MAP = [
|
||||
@@ -636,15 +639,4 @@ class ImportService
|
||||
return strtolower($value);
|
||||
}
|
||||
|
||||
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