本文整理匯總了PHP中DomDocument::queryToValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP DomDocument::queryToValue方法的具體用法?PHP DomDocument::queryToValue怎麽用?PHP DomDocument::queryToValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DomDocument
的用法示例。
在下文中一共展示了DomDocument::queryToValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: factory
/**
* @param DomDocument $context
* @param \BaseXMS\Mvc\SiteAccess $siteAccess
* @return Ambigous <NULL, unknown, \BaseXMS\RequestHandler\RequestHandler>
*/
public static function factory($context, \BaseXMS\Mvc\SiteAccess $siteAccess)
{
$return = null;
$services = $siteAccess->getServiceLocator();
// Get Request handler class
$requestHandlerClass = $context->queryToValue('//contentclass');
//TODO: contentclass is not really the right name
if (!$requestHandlerClass) {
$requestHandlerClass = '\\BaseXMS\\RequestHandler\\RequestHandler';
$services->get('log')->warn('No RequestHandler class specified - falling back to default class.');
}
if (!class_exists($requestHandlerClass)) {
$services->get('log')->warn('Could not find RequestHandler class: "' . $requestHandlerClass . '".');
$requestHandlerClass = '\\BaseXMS\\RequestHandler\\RequestHandler';
}
$services->get('log')->info('Loading RequestHandler class: "' . $requestHandlerClass . '".');
$return = new $requestHandlerClass();
// couldn't get a valid class
if (!$return instanceof RequestHandler) {
$services->get('log')->warn('"' . $requestHandlerClass . '" is not a RequestHandler - falling back to default class.');
$return = new RequestHandler();
}
$return->setContext($context)->setServiceLocator($services)->setSiteAccess($siteAccess);
return $return;
}