comparison vendor/symfony/translation/Catalogue/TargetOperation.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
26 /** 26 /**
27 * {@inheritdoc} 27 * {@inheritdoc}
28 */ 28 */
29 protected function processDomain($domain) 29 protected function processDomain($domain)
30 { 30 {
31 $this->messages[$domain] = array( 31 $this->messages[$domain] = [
32 'all' => array(), 32 'all' => [],
33 'new' => array(), 33 'new' => [],
34 'obsolete' => array(), 34 'obsolete' => [],
35 ); 35 ];
36 36
37 // For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``, 37 // For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``,
38 // because doing so will drop messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback} 38 // because doing so will drop messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback}
39 // 39 //
40 // For 'new' messages, the code can't be simplied as ``array_diff_assoc($this->target->all($domain), $this->source->all($domain));`` 40 // For 'new' messages, the code can't be simplified as ``array_diff_assoc($this->target->all($domain), $this->source->all($domain));``
41 // because doing so will not exclude messages like {x: x ∈ target ∧ x ∉ source.all ∧ x ∈ source.fallback} 41 // because doing so will not exclude messages like {x: x ∈ target ∧ x ∉ source.all ∧ x ∈ source.fallback}
42 // 42 //
43 // For 'obsolete' messages, the code can't be simplifed as ``array_diff_assoc($this->source->all($domain), $this->target->all($domain))`` 43 // For 'obsolete' messages, the code can't be simplified as ``array_diff_assoc($this->source->all($domain), $this->target->all($domain))``
44 // because doing so will not exclude messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback} 44 // because doing so will not exclude messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback}
45 45
46 foreach ($this->source->all($domain) as $id => $message) { 46 foreach ($this->source->all($domain) as $id => $message) {
47 if ($this->target->has($id, $domain)) { 47 if ($this->target->has($id, $domain)) {
48 $this->messages[$domain]['all'][$id] = $message; 48 $this->messages[$domain]['all'][$id] = $message;
49 $this->result->add(array($id => $message), $domain); 49 $this->result->add([$id => $message], $domain);
50 if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { 50 if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) {
51 $this->result->setMetadata($id, $keyMetadata, $domain); 51 $this->result->setMetadata($id, $keyMetadata, $domain);
52 } 52 }
53 } else { 53 } else {
54 $this->messages[$domain]['obsolete'][$id] = $message; 54 $this->messages[$domain]['obsolete'][$id] = $message;
57 57
58 foreach ($this->target->all($domain) as $id => $message) { 58 foreach ($this->target->all($domain) as $id => $message) {
59 if (!$this->source->has($id, $domain)) { 59 if (!$this->source->has($id, $domain)) {
60 $this->messages[$domain]['all'][$id] = $message; 60 $this->messages[$domain]['all'][$id] = $message;
61 $this->messages[$domain]['new'][$id] = $message; 61 $this->messages[$domain]['new'][$id] = $message;
62 $this->result->add(array($id => $message), $domain); 62 $this->result->add([$id => $message], $domain);
63 if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { 63 if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) {
64 $this->result->setMetadata($id, $keyMetadata, $domain); 64 $this->result->setMetadata($id, $keyMetadata, $domain);
65 } 65 }
66 } 66 }
67 } 67 }