]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/translation/Symfony/Component/Translation/Catalogue/MergeOperation.php
0052363efeaf7e6769183641ef03694c88ee9dd1
[github/wallabag/wallabag.git] / vendor / symfony / translation / Symfony / Component / Translation / Catalogue / MergeOperation.php
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Translation\Catalogue;
13
14 /**
15 * Merge operation between two catalogues.
16 *
17 * @author Jean-François Simon <contact@jfsimon.fr>
18 */
19 class MergeOperation extends AbstractOperation
20 {
21 /**
22 * {@inheritdoc}
23 */
24 protected function processDomain($domain)
25 {
26 $this->messages[$domain] = array(
27 'all' => array(),
28 'new' => array(),
29 'obsolete' => array(),
30 );
31
32 foreach ($this->source->all($domain) as $id => $message) {
33 $this->messages[$domain]['all'][$id] = $message;
34 $this->result->add(array($id => $message), $domain);
35 }
36
37 foreach ($this->target->all($domain) as $id => $message) {
38 if (!$this->source->has($id, $domain)) {
39 $this->messages[$domain]['all'][$id] = $message;
40 $this->messages[$domain]['new'][$id] = $message;
41 $this->result->add(array($id => $message), $domain);
42 }
43 }
44 }
45 }