本文整理汇总了PHP中pts_client::parse_value_string_double_identifier方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_client::parse_value_string_double_identifier方法的具体用法?PHP pts_client::parse_value_string_double_identifier怎么用?PHP pts_client::parse_value_string_double_identifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_client
的用法示例。
在下文中一共展示了pts_client::parse_value_string_double_identifier方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run($r)
{
$module = strtolower($r[0]);
$pre_message = null;
if (!class_exists($module)) {
pts_module_manager::load_module($module);
}
$module_name = pts_module_manager::module_call($module, 'module_name');
$module_description = pts_module_manager::module_call($module, 'module_description');
$module_setup = pts_module_manager::module_call($module, 'module_setup');
pts_client::$display->generic_heading($module_name . ' Module Configuration');
echo $module_description . PHP_EOL;
if (count($module_setup) == 0) {
echo PHP_EOL . 'There are no options available for configuring with the ' . $module . ' module.' . PHP_EOL;
} else {
if (($module_presets = pts_client::read_env('PTS_MODULE_SETUP')) != false) {
$module_presets = pts_client::parse_value_string_double_identifier($module_presets);
}
$set_options = array();
foreach ($module_setup as $module_option) {
if ($module_option instanceof pts_module_option) {
$option_identifier = $module_option->get_identifier();
if (isset($module_presets[$module][$option_identifier]) && $module_option->is_supported_value($module_presets[$module][$option_identifier])) {
echo PHP_EOL . $module_option->get_formatted_question();
echo $module_presets[$module][$option_identifier] . PHP_EOL;
$input = $module_presets[$module][$option_identifier];
} else {
do {
echo PHP_EOL . $module_option->get_formatted_question();
$input = pts_user_io::read_user_input();
} while (!$module_option->is_supported_value($input));
}
if (empty($input)) {
$input = $module_option->get_default_value();
}
$set_options[$option_identifier] = $input;
}
}
$set_options = pts_module_manager::module_call($module, 'module_setup_validate', $set_options);
if (!empty($set_options)) {
pts_module::module_config_save($module, $set_options);
}
}
echo PHP_EOL;
}
示例2: prompt_user_options
public static function prompt_user_options(&$test_profile, $preset_selections = null)
{
$user_args = array();
$text_args = array();
if (($cli_presets_env = pts_client::read_env('PRESET_OPTIONS')) != false) {
// To specify test options externally from an environment variable
// i.e. PRESET_OPTIONS='stream.run-type=Add' ./phoronix-test-suite benchmark stream
// The string format is <test-name>.<test-option-name-from-XML-file>=<test-option-value>
// The test-name can either be the short/base name (e.g. stream) or the full identifier (pts/stream) without version postfix
// Multiple preset options can be delimited with the PRESET_OPTIONS environment variable via a semicolon ;
$preset_selections = pts_client::parse_value_string_double_identifier($cli_presets_env);
}
$identifier_short = $test_profile->get_identifier_base_name();
$identifier_full = $test_profile->get_identifier(false);
if (count($test_profile->get_test_option_objects()) > 0) {
pts_client::$display->test_run_configure($test_profile);
}
foreach ($test_profile->get_test_option_objects() as $i => $o) {
$option_identifier = $o->get_identifier();
if ($o->option_count() == 0) {
// User inputs their option as there is nothing to select
if (isset($preset_selections[$identifier_short][$option_identifier])) {
$value = $preset_selections[$identifier_short][$option_identifier];
echo PHP_EOL . ' Using Pre-Set Run Option: ' . $value . PHP_EOL;
} else {
if (isset($preset_selections[$identifier_full][$option_identifier])) {
$value = $preset_selections[$identifier_full][$option_identifier];
echo PHP_EOL . ' Using Pre-Set Run Option: ' . $value . PHP_EOL;
} else {
echo PHP_EOL . $o->get_name() . PHP_EOL;
$value = pts_user_io::prompt_user_input('Enter Value');
}
}
array_push($text_args, array($o->format_option_display_from_input($value)));
array_push($user_args, array($o->format_option_value_from_input($value)));
} else {
// Have the user select the desired option
if (isset($preset_selections[$identifier_short][$option_identifier])) {
$bench_choice = $preset_selections[$identifier_short][$option_identifier];
echo PHP_EOL . ' Using Pre-Set Run Option: ' . $bench_choice . PHP_EOL;
} else {
if (isset($preset_selections[$identifier_full][$option_identifier])) {
$bench_choice = $preset_selections[$identifier_full][$option_identifier];
echo PHP_EOL . ' Using Pre-Set Run Option: ' . $bench_choice . PHP_EOL;
} else {
$option_names = $o->get_all_option_names_with_messages();
if (count($option_names) > 1) {
//echo PHP_EOL . $o->get_name() . ':' . PHP_EOL;
array_push($option_names, 'Test All Options');
}
$bench_choice = pts_user_io::prompt_text_menu($o->get_name(), $option_names, true, true, pts_client::$display->get_tab() . pts_client::$display->get_tab());
echo PHP_EOL;
}
}
$bench_choice = $o->parse_selection_choice_input($bench_choice);
// Format the selected option(s)
$option_args = array();
$option_args_description = array();
foreach ($bench_choice as $c) {
array_push($option_args, $o->format_option_value_from_select($c));
array_push($option_args_description, $o->format_option_display_from_select($c));
}
array_push($text_args, $option_args_description);
array_push($user_args, $option_args);
}
}
$test_args = array();
$test_args_description = array();
self::compute_all_combinations($test_args, null, $user_args, 0);
self::compute_all_combinations($test_args_description, null, $text_args, 0, ' - ');
return array($test_args, $test_args_description);
}