This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Esun\Agent\Model\Source;
use Esun\Agent\Model\Map\CountryPosition;
use Magento\Directory\Model\Config\Source\Country;
use Magento\Framework\Data\OptionSourceInterface;
class MapCountry implements OptionSourceInterface
{
public function __construct(
private readonly Country $countrySource,
private readonly CountryPosition $countryPosition
) {
}
public function toOptionArray(): array
{
return array_values(array_filter(
$this->countrySource->toOptionArray(),
fn (array $option): bool => (string) ($option['value'] ?? '') === ''
|| $this->countryPosition->has((string) $option['value'])
));
}
}