本文整理汇总了PHP中JMS\TranslationBundle\Model\Message::getMeaning方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::getMeaning方法的具体用法?PHP Message::getMeaning怎么用?PHP Message::getMeaning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMS\TranslationBundle\Model\Message
的用法示例。
在下文中一共展示了Message::getMeaning方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMerge
public function testMerge()
{
$message = new Message('foo');
$message->setDesc('foo');
$message->setMeaning('foo');
$message->addSource($s1 = $this->getMock('JMS\\TranslationBundle\\Model\\SourceInterface'));
$message2 = new Message('foo');
$message2->setDesc('bar');
$message2->addSource($s2 = $this->getMock('JMS\\TranslationBundle\\Model\\SourceInterface'));
$message->merge($message2);
$this->assertEquals('bar', $message->getDesc());
$this->assertEquals('foo', $message->getMeaning());
$this->assertSame(array($s1, $s2), $message->getSources());
}
示例2: mergeExisting
/**
* Merges a message from an existing translation catalogue.
*
* Do not use this if you want to merge a message from an extracted catalogue.
* In these cases, use merge() instead.
*
* @param Message $message
*/
public function mergeExisting(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->new = $message->isNew();
if ($localeString = $message->getLocaleString()) {
$this->localeString = $localeString;
}
}
示例3: mergeScanned
/**
* {@inheritDoc}
*/
public function mergeScanned(Message $message)
{
if ($this->getId() !== $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()));
}
$this->setSources($message->getSources());
$oldDesc = $this->getDesc();
if ($this->isWritable()) {
if (null === $this->getMeaning()) {
$this->setMeaning($message->getMeaning());
}
if (null === $this->getDesc()) {
$this->setDesc($message->getDesc());
}
if (!$this->getLocaleString()) {
$this->setLocaleString($message->getLocaleString());
}
}
$this->mergeXliffMeta($message, $oldDesc);
}
示例4: mergeScanned
/**
* Merge a scanned message into an extising message.
*
* This method does essentially the same as {@link mergeExisting()} but with reversed operands.
* Whereas {@link mergeExisting()} is used to merge an existing message into a scanned message (this),
* {@link mergeScanned()} is used to merge a scanned message into an existing message (this).
* The result of both methods is the same, except that the result will end up in the existing message,
* instead of the scanned message, so extra information read from the existing message is not discarded.
*
* @param Message $message
*
* @author Dieter Peeters <peetersdiet@gmail.com>
*/
public function mergeScanned(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 === $this->getMeaning()) {
$this->meaning = $message->getMeaning();
}
if (null === $this->getDesc()) {
$this->desc = $message->getDesc();
}
$this->sources = array();
foreach ($message->getSources() as $source) {
$this->addSource($source);
}
if (!$this->getLocaleString()) {
$this->localeString = $message->getLocaleString();
}
}