本文整理匯總了PHP中midcom_core_context::get_key方法的典型用法代碼示例。如果您正苦於以下問題:PHP midcom_core_context::get_key方法的具體用法?PHP midcom_core_context::get_key怎麽用?PHP midcom_core_context::get_key使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類midcom_core_context
的用法示例。
在下文中一共展示了midcom_core_context::get_key方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run_handler
public function run_handler($topic, array $args = array())
{
if (is_object($topic)) {
$component = $topic->component;
} else {
$component = $topic;
$topic = $this->get_component_node($component);
}
$context = new midcom_core_context(null, $topic);
$context->set_current();
$context->set_key(MIDCOM_CONTEXT_URI, midcom_connection::get_url('self') . $topic->name . '/' . implode('/', $args) . '/');
// Parser Init: Generate arguments and instantiate it.
$context->parser = midcom::get('serviceloader')->load('midcom_core_service_urlparser');
$context->parser->parse($args);
$handler = $context->get_handler($topic);
$context->set_key(MIDCOM_CONTEXT_CONTENTTOPIC, $topic);
$this->assertTrue(is_a($handler, 'midcom_baseclasses_components_interface'), $component . ' found no handler for ./' . implode('/', $args) . '/');
$result = $handler->handle();
$this->assertTrue($result !== false, $component . ' handle returned false on ./' . implode('/', $args) . '/');
$data =& $handler->_context_data[$context->id]['handler']->_handler['handler'][0]->_request_data;
if (is_object($result) && $result instanceof midcom_response) {
$data['__openpsa_testcase_response'] = $result;
}
$data['__openpsa_testcase_handler'] = $handler->_context_data[$context->id]['handler']->_handler['handler'][0];
$data['__openpsa_testcase_handler_method'] = $handler->_context_data[$context->id]['handler']->_handler['handler'][1];
// added to simulate http uri composition
$_SERVER['REQUEST_URI'] = $context->get_key(MIDCOM_CONTEXT_URI);
return $data;
}