本文整理汇总了PHP中Translation::getFlags方法的典型用法代码示例。如果您正苦于以下问题:PHP Translation::getFlags方法的具体用法?PHP Translation::getFlags怎么用?PHP Translation::getFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translation
的用法示例。
在下文中一共展示了Translation::getFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergeFlags
/**
* Merge the flags of two translations.
*
* @param Translation $from
* @param Translation $to
* @param int $options
*/
public static function mergeFlags(Translation $from, Translation $to, $options = self::DEFAULTS)
{
if ($options & self::FLAGS_THEIRS) {
$to->deleteFlags();
}
if (!($options & self::FLAGS_OURS)) {
foreach ($from->getFlags() as $flag) {
$to->addFlag($flag);
}
}
}
示例2: mergeWith
/**
* Merges this translation with other translation
*
* @param Translation $translation The translation to merge with
* @param integer|null $method One or various Translations::MERGE_* constants to define how to merge the translations
*/
public function mergeWith(Translation $translation, $method = null)
{
if ($method === null) {
$method = Translations::$mergeDefault;
}
if (!$this->hasTranslation()) {
$this->setTranslation($translation->getTranslation());
}
if ($method & Translations::MERGE_PLURAL && !$this->hasPlural()) {
$this->setPlural($translation->getPlural());
}
if ($this->hasPlural() && !$this->hasPluralTranslation() && $translation->hasPluralTranslation()) {
$this->pluralTranslation = $translation->getPluralTranslation();
}
if ($method & Translations::MERGE_REFERENCES) {
foreach ($translation->getReferences() as $reference) {
$this->addReference($reference[0], $reference[1]);
}
}
if ($method & Translations::MERGE_COMMENTS) {
$this->comments = array_values(array_unique(array_merge($translation->getComments(), $this->comments)));
$this->extractedComments = array_values(array_unique(array_merge($translation->getExtractedComments(), $this->extractedComments)));
$this->flags = array_values(array_unique(array_merge($translation->getFlags(), $this->flags)));
}
}