本文整理汇总了PHP中question_utils::int_to_roman方法的典型用法代码示例。如果您正苦于以下问题:PHP question_utils::int_to_roman方法的具体用法?PHP question_utils::int_to_roman怎么用?PHP question_utils::int_to_roman使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_utils
的用法示例。
在下文中一共展示了question_utils::int_to_roman方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: number_in_style
/**
* @param int $num The number, starting at 0.
* @param string $style The style to render the number in. One of the
* options returned by {@link qtype_multichoice:;get_numbering_styles()}.
* @return string the number $num in the requested style.
*/
protected function number_in_style($num, $style) {
switch($style) {
case 'abc':
$number = chr(ord('a') + $num);
break;
case 'ABCD':
$number = chr(ord('A') + $num);
break;
case '123':
$number = $num + 1;
break;
case 'iii':
$number = question_utils::int_to_roman($num + 1);
break;
case 'IIII':
$number = strtoupper(question_utils::int_to_roman($num + 1));
break;
case 'none':
return '';
default:
return 'ERR';
}
return $this->number_html($number);
}
示例2: number_answer
/**
* @param int $num The number, starting at 0.
* @param string $style The style to render the number in. One of the
* options returned by {@link qtype_multichoice:;get_numbering_styles()}.
* @return string the number $num in the requested style.
*/
public static function number_answer($num, $style)
{
switch ($style) {
case 'abc':
$number = chr(ord('a') + $num);
break;
case 'ABCD':
$number = chr(ord('A') + $num);
break;
case '123':
$number = $num + 1;
break;
case 'iii':
$number = question_utils::int_to_roman($num + 1);
break;
case 'IIII':
$number = strtoupper(question_utils::int_to_roman($num + 1));
break;
case 'none':
return '';
default:
return 'ERR';
}
return "({$number})";
}
示例3: test_int_to_roman_not_int
/**
* @expectedException moodle_exception
*/
public function test_int_to_roman_not_int()
{
question_utils::int_to_roman(1.5);
}
示例4: test_int_to_roman_not_int
public function test_int_to_roman_not_int()
{
$this->setExpectedException('moodle_exception');
question_utils::int_to_roman(1.5);
}
示例5: test_int_to_roman_not_int
public function test_int_to_roman_not_int()
{
$this->expectException();
question_utils::int_to_roman(1.5);
}