<?php
 namespace App\Core\Payment\Concerns; trait GatesInstallmentByCurrency { protected function installmentCurrencyAllowed(?string $currencyCode): bool { if ($currencyCode === null || trim($currencyCode) === '') { return true; } $allowed = $this->allowedInstallmentCurrencies(); if ($allowed === []) { return false; } return in_array(strtoupper(trim($currencyCode)), $allowed, true); } protected function allowedInstallmentCurrencies(): array { $raw = (string) $this->getConfig('installment_currencies', 'TRY'); $codes = array_filter(array_map(static function ($code): string { return strtoupper(trim((string) $code)); }, explode(',', $raw)), static function (string $code): bool { return $code !== ''; }); if ($codes === []) { return ['TRY']; } return array_values(array_unique($codes)); } } 