/** * Merges an extracted message. * * Do not use this if you want to merge a message from an existing catalogue. * In these cases, use mergeExisting() instead. * * @param Message $message * * @throws RuntimeException */ public function merge(Message $message) { if ($this->id !== $message->getId()) { throw new RuntimeException(sprintf('You can only merge messages with the same id. Expected id "%s", but got "%s".', $this->id, $message->getId())); } if (null !== ($meaning = $message->getMeaning())) { $this->meaning = $meaning; } if (null !== ($desc = $message->getDesc())) { $this->desc = $desc; $this->localeString = null; if ($message->hasLocaleString()) { $this->localeString = $message->getLocaleString(); } } foreach ($message->getSources() as $source) { $this->addSource($source); } $this->setNew($message->isNew()); }