本文整理汇总了PHP中RecursiveIteratorIterator::getBasename方法的典型用法代码示例。如果您正苦于以下问题:PHP RecursiveIteratorIterator::getBasename方法的具体用法?PHP RecursiveIteratorIterator::getBasename怎么用?PHP RecursiveIteratorIterator::getBasename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecursiveIteratorIterator
的用法示例。
在下文中一共展示了RecursiveIteratorIterator::getBasename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getPluggableFiles
private function _getPluggableFiles()
{
$FilePaths = array();
$directory = new \RecursiveDirectoryIterator($this->directory);
foreach ($F = new \RecursiveIteratorIterator($directory) as $filepath) {
if (!$F->isDot() && $F->getDepth() === 1) {
if ($F->getBasename() === $this->filename) {
$FilePaths[] = $filepath;
}
}
}
return $FilePaths;
}
示例2: execute
/**
* Executes the transformation process.
*
* @throws Zend_Console_Getopt_Exception
*
* @return void
*/
public function execute()
{
$results = array();
$longest_name = 0;
/** @var RecursiveDirectoryIterator $files */
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/../'));
while ($files->valid()) {
// skip abstract files
if (!$files->isFile() || $files->getBasename() == 'Abstract.php') {
$files->next();
continue;
}
// convert the filename to a class
$class_name = 'DocBlox_Task_' . str_replace(DIRECTORY_SEPARATOR, '_', $files->getSubPath()) . '_' . $files->getBasename('.php');
// check if the class exists, if so: add it to the list
if (class_exists($class_name)) {
$name = $files->getBasename('.php');
$longest_name = max(strlen($name), $longest_name);
$results[strtolower($files->getSubPath())][strtolower($name)] = $files->getRealPath();
}
$files->next();
}
// echo the list of namespaces with their tasks
ksort($results, SORT_STRING);
foreach ($results as $namespace => $tasks) {
echo $namespace . PHP_EOL;
asort($tasks, SORT_STRING);
foreach ($tasks as $task => $filename) {
// get the short description by reflecting the file.
$refl = new DocBlox_Reflection_File($filename, false);
$refl->setLogLevel(DocBlox_Core_Log::QUIET);
$refl->process();
/** @var DocBlox_Reflection_Class $class */
$class = current($refl->getClasses());
echo ' :' . str_pad($task, $longest_name + 2) . $class->getDocBlock()->getShortDescription() . PHP_EOL;
}
}
echo PHP_EOL;
}