本文整理匯總了PHP中FileSet::getDirectoryScanner方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileSet::getDirectoryScanner方法的具體用法?PHP FileSet::getDirectoryScanner怎麽用?PHP FileSet::getDirectoryScanner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileSet
的用法示例。
在下文中一共展示了FileSet::getDirectoryScanner方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDirectoryScanner
/**
* Returns the directory scanner needed to access the files to process.
* @return DirectoryScanner
*/
protected function getDirectoryScanner(PhingFile $baseDir)
{
$this->fileset->setDir($baseDir);
$this->fileset->setDefaultexcludes($this->useDefaultExcludes);
return $this->fileset->getDirectoryScanner($this->project);
}
示例2: processFileSet
/**
* @param FileSet $fs
* @throws BuildException
*/
protected function processFileSet(FileSet $fs)
{
$files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
$fullPath = realpath($fs->getDir($this->project));
foreach ($files as $file) {
$this->log('Minifying file ' . $file);
try {
$target = $this->targetDir . '/' . str_replace($fullPath, '', str_replace('.js', $this->suffix . '.js', $file));
if (file_exists(dirname($target)) === false) {
mkdir(dirname($target), 0777 - umask(), true);
}
$contents = file_get_contents($fullPath . '/' . $file);
// nasty hack to not trip PHP 5.2 parser
$minified = forward_static_call(array('\\JShrink\\Minifier', 'minify'), $contents);
file_put_contents($target, $minified);
} catch (Exception $jsme) {
$this->log("Could not minify file {$file}: " . $jsme->getMessage(), Project::MSG_ERR);
}
}
}