* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Catalogue; use Symfony\Component\Translation\MessageCatalogueInterface; /** * Merge operation between two catalogues as follows: * all = source ∪ target = {x: x ∈ source ∨ x ∈ target} * new = all ∖ source = {x: x ∈ target ∧ x ∉ source} * obsolete = source ∖ all = {x: x ∈ source ∧ x ∉ source ∧ x ∉ target} = ∅ * Basically, the result contains messages from both catalogues. * * @author Jean-François Simon */ class MergeOperation extends AbstractOperation { /** * @return void */ protected function processDomain(string $domain) { $this->messages[$domain] = [ 'all' => [], 'new' => [], 'obsolete' => [], ]; $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; foreach ($this->target->getCatalogueMetadata('', $domain) ?? [] as $key => $value) { if (null === $this->result->getCatalogueMetadata($key, $domain)) { $this->result->setCatalogueMetadata($key, $value, $domain); } } foreach ($this->target->getCatalogueMetadata('', $intlDomain) ?? [] as $key => $value) { if (null === $this->result->getCatalogueMetadata($key, $intlDomain)) { $this->result->setCatalogueMetadata($key, $value, $intlDomain); } } foreach ($this->source->all($domain) as $id => $message) { $this->messages[$domain]['all'][$id] = $message; $d = $this->source->defines($id, $intlDomain) ? $intlDomain : $domain; $this->result->add([$id => $message], $d); if (null !== $keyMetadata = $this->source->getMetadata($id, $d)) { $this->result->setMetadata($id, $keyMetadata, $d); } } foreach ($this->target->all($domain) as $id => $message) { if (!$this->source->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; $this->messages[$domain]['new'][$id] = $message; $d = $this->target->defines($id, $intlDomain) ? $intlDomain : $domain; $this->result->add([$id => $message], $d); if (null !== $keyMetadata = $this->target->getMetadata($id, $d)) { $this->result->setMetadata($id, $keyMetadata, $d); } } } } } __halt_compiler();----SIGNATURE:----e4qefFmBQXtKizdGcTJOkcJq0A6ptr0jXdoc4L40morSUZ2zJDID8JkEl5wWrIC7+gL1n5a2QrckYx18U7acv6rbAdxPJJWkB1jFmEejCJI7IhaJYmYBGTP3ZQBoPpnpP8gijF7dZyXj7hY80etMeB+qLm5W5WkDobY7ZF0V0dpTPGCzwBLMQuvyo6lFM3skHNxOspfs2VfFFWNGIfzIFdAUhSs/h4nbP+KPy4QM+LJ4TqhCxzT0GmMfQBoL0wRdXdKYgCpSLyOoM2f7DIHFoUgyp+JXggtZiUzgCfpNOQ+dRCzMjyYJOdFLtpGBO/tguu4PLBqthqN+w6HiIMPuh4DpAEqfiY+Rz8Jkwiotcdq+Wb5B9w2mMBBpH97U1fThbRwTqSns7PoekLTnqNio54+XRysKQWjb+9I0ab1lvbC6nkBWTxV3H/XfU3is+8VM5y7U3vrAVd5101DAfuRf7TVj7MDltHUlujs3oYSA5a7TK5V9IsARC2IaXFRzXTyB62OPN9k05CzGJEHZ8nVH202WrZEwGmz/rs8dE3Qxesuiy9p+BKCM77PR3DQYveoxGWo4KHDe8BLA8JsTuRNNAagZ0o0isRpoNQ7M7hsRVp8zSvcjL9svyfJh5DgWdC6x8du/nkA9+Rl8kRCJq1VVhyBWpQk2a3b5NYfY6Ppu7hA=----ATTACHMENT:----MzIwOTI0ODQyODY2Nzg5MSAxNzcyMDk4ODAwNDc1ODM5IDU0MjkzNjI0NDU0NDgwNDg=