public function get_test_option_objects($auto_process = true) { $test_options = array(); if ($this->xml->TestSettings && $this->xml->TestSettings->Option) { foreach ($this->xml->TestSettings->Option as $option) { $names = array(); $messages = array(); $values = array(); if (isset($option->Menu->Entry)) { foreach ($option->Menu->Entry as $entry) { array_push($names, $entry->Name->__toString()); array_push($messages, $entry->Message->__toString()); array_push($values, $entry->Value->__toString()); } } if ($auto_process) { pts_test_run_options::auto_process_test_option($this->identifier, $option->Identifier, $names, $values, $messages); } $user_option = new pts_test_option($option->Identifier->__toString(), $option->DisplayName->__toString()); $user_option->set_option_prefix($option->ArgumentPrefix->__toString()); $user_option->set_option_postfix($option->ArgumentPostfix->__toString()); for ($i = 0; $i < count($names); $i++) { $user_option->add_option($names[$i], isset($values[$i]) ? $values[$i] : null, isset($messages[$i]) ? $messages[$i] : null); } $user_option->set_option_default($option->DefaultEntry->__toString()); array_push($test_options, $user_option); } } return $test_options; }
public function get_test_option_objects($auto_process = true) { $settings_name = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/TestSettings/Option/DisplayName'); $settings_argument_prefix = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/TestSettings/Option/ArgumentPrefix'); $settings_argument_postfix = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/TestSettings/Option/ArgumentPostfix'); $settings_identifier = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/TestSettings/Option/Identifier'); $settings_default = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/TestSettings/Option/DefaultEntry'); $option_names = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/TestSettings/Option/Menu/Entry/Name', 1); $option_messages = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/TestSettings/Option/Menu/Entry/Message', 1); $option_values = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/TestSettings/Option/Menu/Entry/Value', 1); $test_options = array(); foreach (array_keys($settings_name) as $option_count) { $names = $option_names[$option_count]; $messages = $option_messages[$option_count]; $values = $option_values[$option_count]; if ($auto_process) { pts_test_run_options::auto_process_test_option($this->identifier, $settings_identifier[$option_count], $names, $values, $messages); } $user_option = new pts_test_option($settings_identifier[$option_count], $settings_name[$option_count]); $user_option->set_option_prefix($settings_argument_prefix[$option_count]); $user_option->set_option_postfix($settings_argument_postfix[$option_count]); for ($i = 0; $i < count($names); $i++) { $user_option->add_option($names[$i], isset($values[$i]) ? $values[$i] : null, isset($messages[$i]) ? $messages[$i] : null); } $user_option->set_option_default($settings_default[$option_count]); array_push($test_options, $user_option); } return $test_options; }