* * 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:----uBx5hv/S1JkupmRs/xo8ma5Tk/TJt1NdF6C+nd1LliBi2ZBdnWy4YRlpE/RTMRE3Leq1NMgGEmOtKStHT3WPFAg6NwrUwOR+C1NcG4R/1UnMhsblpIRSBKpaLkFB8lNGuRKpiNu82YAFPHjwfWYjcHkuXbeJVPdQpQiUw/le3hz4/5Wus/4GHiSmzIAY4bbYdEj94SURoBwRueLobSg3rRX2zC/Vd1CiykDJwo3ijPB8Zdwf0mgxYycD7gRzE5Z6NJ+7bQcA/em/zHJRxgjq1jd8Rm+RRlgUzJ6uMdB9/tjGxYz6+cB2WtIzz7udRBUT7Shf0OseR5lq5tgoHLlcmfrN7SmKSqXukvsnidypUPRyr4XPSEP2aPWG7lBq2326iFxti4tCkhf66btEEGd35SNGaotadJ/RkFgCH3drdB4fPWN1Xh0aNF7xuEXF/+qeK1txODVXfcuG078jZXffa0bWoVBediKsOu9ew1yjkR8qCnvDcceF/nQ9jXk8P+io/gxueZacL659oO9zhaDDua7z3ULBM9L0vbjQbIx1qBRQJAzfDHSon+GtGfrRAOu1AsRIKpZUQabqT8atHbzKTvabO0UXXCn7y8m0rSD2FYjSuF4+mRYD5Gbj2t652gqTPu/aly8oz5VVDn4PWg7yZv2Z60nkczYNe298rCS47XM=----ATTACHMENT:----OTY2MzkyNjYzODA3NDY2NyA0ODI0Mjg0ODQyMjM2MzY1IDI5MDQ2Njc3MTE3MDg4NDM=