本文整理匯總了PHP中FileUtils::getAbsPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileUtils::getAbsPath方法的具體用法?PHP FileUtils::getAbsPath怎麽用?PHP FileUtils::getAbsPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileUtils
的用法示例。
在下文中一共展示了FileUtils::getAbsPath方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getIncludeFilesDataFlows
/**
* 獲取當前文件include的所有文件的summary
* @param FileSummary $fileSummary
* @return array(fileSummarys)
*/
public static function getIncludeFilesDataFlows($fileSummary)
{
if (!is_object($fileSummary)) {
return;
}
//1.得到include files
$includeFiles = $fileSummary->getIncludeMap();
$currentFilePath = $fileSummary->getPath();
//2.foreach() files
$retFileSummary = array();
foreach ($includeFiles as $rpath) {
$absPath = FileUtils::getAbsPath($currentFilePath, $rpath);
if (!$absPath) {
continue;
}
// 查看是否在fileSummaryContext中
// 得到DataFlows
$fileSummaryContext = FileSummaryContext::getInstance();
$ret = $fileSummaryContext->findSummaryByPath($absPath);
if (is_object($ret)) {
//查看此文件是否有include文件
$pRetFiles = self::getIncludeFilesDataFlows($ret);
$retFileSummary = array_merge($pRetFiles, $retFileSummary);
$retFileSummary = array_merge(array($ret), $retFileSummary);
} else {
$includeFileSummary = self::getFileSummary($absPath);
if (is_object($includeFileSummary)) {
$pRetFiles = self::getIncludeFilesDataFlows($includeFileSummary);
$retFileSummary = array_merge($pRetFiles, $retFileSummary);
$retFileSummary = array_merge(array($includeFileSummary), $retFileSummary);
}
}
}
//return all files summary
//include在前的,在數組前麵
return $retFileSummary;
}
示例2: getRequireFileFuncs
/**
* @param 當前文件路徑 $path
* @param 當前文件包含文件路徑集合 $require_array
* @return 返回當前文件包含文件的函數集合
*/
public function getRequireFileFuncs($path, $require_array)
{
$tempRequireFile = array();
//將文件自身添加
array_push($tempRequireFile, $path);
//補全路徑
$currentDir = dirname($path);
global $project_path;
foreach ($require_array as $filepath) {
$absPath = FileUtils::getAbsPath($path, $filepath);
if ($absPath) {
array_push($tempRequireFile, $absPath);
}
}
$records = array();
//不能定義同名類和函數,不同類方法可以相同
//尋找相應的method
foreach ($this->records as $record) {
if (in_array($record->path, $tempRequireFile)) {
array_push($records, $record);
}
}
return $records;
}