本文整理汇总了PHP中MantisEnum::getLabelForUnknownValue方法的典型用法代码示例。如果您正苦于以下问题:PHP MantisEnum::getLabelForUnknownValue方法的具体用法?PHP MantisEnum::getLabelForUnknownValue怎么用?PHP MantisEnum::getLabelForUnknownValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MantisEnum
的用法示例。
在下文中一共展示了MantisEnum::getLabelForUnknownValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLocalizedLabel
/**
* Gets the localized label corresponding to a value. Note that this method
* takes in the standard / localized enums so that if the value is in the localized
* enum but not the standard one, then it returns not found.
*
* @param string $enumString The standard enum string.
* @param string $localizedEnumString The localized enum string.
* @param integer $value The value to lookup.
*
* @return the label or the decorated value to represent not found.
*/
public static function getLocalizedLabel($enumString, $localizedEnumString, $value)
{
if (!MantisEnum::hasValue($enumString, $value)) {
return MantisEnum::getLabelForUnknownValue($value);
}
return MantisEnum::getLabel($localizedEnumString, $value);
}
示例2: getLocalizedLabel
/**
* Gets the localized label corresponding to a value. Note that this method
* takes in the standard / localized enums so that if the value is in the localized
* enum but not the standard one, then it returns not found.
*
* @param string $p_enum_string The standard enum string.
* @param string $p_localized_enum_string The localized enum string.
* @param integer $p_value The value to lookup.
*
* @return string the label or the decorated value to represent not found.
*/
public static function getLocalizedLabel($p_enum_string, $p_localized_enum_string, $p_value)
{
if (!MantisEnum::hasValue($p_enum_string, $p_value)) {
return MantisEnum::getLabelForUnknownValue($p_value);
}
$t_assoc_array = MantisEnum::getAssocArrayIndexedByValues($p_localized_enum_string);
if (isset($t_assoc_array[(int) $p_value])) {
return $t_assoc_array[(int) $p_value];
}
return MantisEnum::getLabel($p_enum_string, $p_value);
}