public function moveMessagesToIntlDomainsIfPossible(string
$batch = self::ALL_BATCH
): void
{ // If MessageFormatter class does not exists, intl domains are not supported.
if (!
class_exists(\MessageFormatter::
class)) { return;
} foreach ($this->
getDomains() as $domain) { $intlDomain =
$domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX;
$messages =
match ($batch) { self::OBSOLETE_BATCH =>
$this->
getObsoleteMessages($domain),
self::NEW_BATCH =>
$this->
getNewMessages($domain),
self::ALL_BATCH =>
$this->
getMessages($domain),
default =>
throw new \
InvalidArgumentException(sprintf('$batch argument must be one of ["%s", "%s", "%s"].', self::ALL_BATCH, self::NEW_BATCH, self::OBSOLETE_BATCH
)),
};
if (!
$messages || (!
$this->source->
all($intlDomain) &&
$this->source->
all($domain))) { continue;
} $result =
$this->
getResult();
$allIntlMessages =
$result->
all($intlDomain);
$currentMessages =
array_diff_key($messages,
$result->
all($domain));