本文整理汇总了PHP中ClassLoader::parseClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::parseClassName方法的具体用法?PHP ClassLoader::parseClassName怎么用?PHP ClassLoader::parseClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassLoader
的用法示例。
在下文中一共展示了ClassLoader::parseClassName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requireClassOnce
/**
* This function attempts to require the class corresponding to the specified relative class path.
* If the class has already been loaded, it will not load it again.
* @param String $classPath The path of the class to be loaded.
* @return void
*/
public static function requireClassOnce($classPath)
{
// if the specified class path hasn't already been loaded, attempt to load it
if (!isset(ClassLoader::$loadedClassPaths[$classPath])) {
$className = ClassLoader::parseClassName($classPath);
ClassLoader::$loadedClassPaths[$classPath] = TRUE;
require dirname(dirname(__FILE__)) . "/{$classPath}.class.php";
}
}
示例2: formatRoutingItemUrl
/**
* This method formats a URL for the specified routing item class name, incorporating
* the get parameters specified in the get parameter map.
* @param String $routingItemClassPath The class path of the target routing item.
* @param array $getParamMap A map of get parameters to be included in the URL (optional).
* @return String The formatted URL.
*/
public static function formatRoutingItemUrl($routingItemClassPath, array $getParamMap = NULL)
{
ClassLoader::requireClassOnce($routingItemClassPath);
$routingClassName = ClassLoader::parseClassName($routingItemClassPath);
$url = UrlFormatter::getBaseUrl() . '?' . IndexRoutingItem::INDEX_ROUTING_ITEM_GET_PARAM . '=';
$url .= $routingClassName::getRoutingKey();
if ($getParamMap != NULL) {
foreach ($getParamMap as $key => $value) {
$url .= "&{$key}={$value}";
}
}
return $url;
}
示例3: loadAndMapIndexRoutingItem
/**
* This function loads and maps the index routing item which corresponds to the specified action class path into
* the specified index routing item map.
* @param String $classPath The class path of the index routing item to be loaded.
* @param array &$indexRoutingItemMap A reference to the index routing item map which the loaded action
* will be mapped into.
* @return IndexRoutingItem The index routing item which was created.
*/
function loadAndMapIndexRoutingItem($classPath, array &$indexRoutingItemMap)
{
ClassLoader::requireClassOnce($classPath);
$className = ClassLoader::parseClassName($classPath);
$newIndexRoutingItem = new $className();
$indexRoutingItemMap[$className::getRoutingKey()] = $newIndexRoutingItem;
return $newIndexRoutingItem;
}