refactor(01-tech-debt): extract AllegroTokenManager and StringHelper

Phase 1 complete (2/2 plans):

- Plan 01-01: Extract AllegroTokenManager — OAuth token logic
  centralized from 4 classes into dedicated manager class

- Plan 01-02: Extract StringHelper — nullableString/normalizeDateTime/
  normalizeColorHex extracted from 15+ classes into App\Core\Support\StringHelper;
  removed 19 duplicate private methods

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 23:36:06 +01:00
parent 4c3daf69b7
commit f8db8c0162
26 changed files with 1374 additions and 547 deletions

View File

@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace App\Modules\Settings;
use App\Core\Support\StringHelper;
use PDO;
use Throwable;
@@ -119,7 +120,7 @@ final class IntegrationsRepository
);
$statement->execute([
'id' => $integrationId,
'api_key_encrypted' => $this->nullableString((string) $encrypted),
'api_key_encrypted' => StringHelper::nullableString((string) $encrypted),
]);
}
@@ -147,9 +148,4 @@ final class IntegrationsRepository
return $trimmed === '' ? null : $trimmed;
}
private function nullableString(string $value): ?string
{
$trimmed = trim($value);
return $trimmed === '' ? null : $trimmed;
}
}