本文整理汇总了PHP中pts_client::swap_variables方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_client::swap_variables方法的具体用法?PHP pts_client::swap_variables怎么用?PHP pts_client::swap_variables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_client
的用法示例。
在下文中一共展示了pts_client::swap_variables方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_run_start
public function test_run_start(&$test_run_manager, &$test_result)
{
echo $this->print_test_identifier_prefix($test_result);
if (($test_description = $test_result->get_arguments_description()) != false) {
echo pts_client::swap_variables($test_description, array('pts_client', 'environmental_variables'));
} else {
echo 'Test Starting';
}
echo PHP_EOL;
$this->trial_run_count_current = 0;
$this->expected_trial_run_count = $test_result->test_profile->get_times_to_run();
}
示例2: update_benchmark_status
protected function update_benchmark_status(&$m, &$tr)
{
static $test_run_manager = false;
static $test_result = false;
static $current_state = false;
if ($m != null) {
$test_run_manager = $m;
}
if ($tr != null) {
$test_result = $tr;
}
// GENERAL STUFF FOR CURRENT RUN
$j['pts']['msg']['name'] = 'benchmark_state';
$j['pts']['msg']['current_state'] = 'benchmark';
$j['pts']['msg']['current_test'] = base64_encode($test_result->test_profile->to_json());
$j['pts']['msg']['arguments_description'] = pts_client::swap_variables($test_result->get_arguments_description(), array('pts_client', 'environmental_variables'));
// CURRENT RUN QUEUE
$j['pts']['msg']['test_run_pos'] = $this->trial_run_count_current;
$j['pts']['msg']['test_run_total'] = $this->expected_trial_run_count;
$j['pts']['msg']['test_run_estimated_time'] = $test_result->test_profile->get_estimated_run_time();
if ($j['pts']['msg']['test_run_pos'] > $j['pts']['msg']['test_run_total']) {
// Don't let the run_pos go over run_total so instead dynamically increase run total and try to roughly compensate for increased dynamic run count
$j['pts']['msg']['test_run_estimated_time'] = $test_result->test_profile->get_estimated_run_time() / $j['pts']['msg']['test_run_total'] * ($j['pts']['msg']['test_run_pos'] + 2);
$j['pts']['msg']['test_run_total'] = $j['pts']['msg']['test_run_pos'] + 1;
}
// TOTAL QUEUE
$j['pts']['msg']['test_queue_pos'] = $test_run_manager->get_test_run_position();
$j['pts']['msg']['test_queue_total'] = $test_run_manager->get_test_run_count_reported();
$j['pts']['msg']['test_queue_estimated_run_time'] = $test_run_manager->get_estimated_run_time();
// LATEST RESULT
$this->web_socket_respond($j);
}
示例3: clean_save_name
public static function clean_save_name($input, $is_new_save = true)
{
$input = pts_client::swap_variables($input, array('pts_client', 'user_run_save_variables'));
$input = pts_strings::remove_redundant(pts_strings::keep_in_string(str_replace(' ', '-', trim($input)), pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DASH), '-');
if ($is_new_save) {
$input = strtolower($input);
}
if (strlen($input) > 126) {
$input = substr($input, 0, 126);
}
return $input;
}
示例4: test_run_start
public function test_run_start(&$test_run_manager, &$test_result)
{
echo PHP_EOL . PHP_EOL . $test_result->test_profile->get_title() . ($test_result->test_profile->get_app_version() != null ? ' ' . $test_result->test_profile->get_app_version() : null) . ':' . PHP_EOL . $this->tab . $test_result->test_profile->get_identifier();
if (($test_description = $test_result->get_arguments_description()) != false) {
echo ' [' . pts_client::swap_variables($test_description, array('pts_client', 'environmental_variables')) . ']';
}
echo PHP_EOL;
echo $this->tab . 'Test ' . $test_run_manager->get_test_run_position() . ' of ' . $test_run_manager->get_test_run_count_reported() . PHP_EOL;
$this->trial_run_count_current = 0;
$this->expected_trial_run_count = $test_result->test_profile->get_times_to_run();
$remaining_length = $test_run_manager->get_estimated_run_time();
$estimated_length = $test_result->test_profile->get_estimated_run_time();
$display_table = array();
array_push($display_table, array($this->tab . 'Estimated Trial Run Count:', $this->expected_trial_run_count));
if ($estimated_length > 1 && $estimated_length != $remaining_length) {
array_push($display_table, array($this->tab . 'Estimated Test Run-Time:', pts_strings::format_time($estimated_length, 'SECONDS', true, 60)));
}
if ($remaining_length > 1) {
array_push($display_table, array($this->tab . 'Estimated Time To Completion:', pts_strings::format_time($remaining_length, 'SECONDS', true, 60)));
}
echo pts_user_io::display_text_table($display_table);
}