<?php $nFiles = 0; $nFilesTotal = 0; $nClasses = 0; $nClassesTotal = 0; file_put_contents(dirname(__FILE__) . '/phpdoc.txt', getPhpDocForDir(dirname(dirname(__FILE__)) . '/framework') . getPhpDocStats()); function getPhpDocStats() { global $nFiles, $nFilesTotal, $nClasses, $nClassesTotal; return "\n\nComments for {$nClasses} classes in {$nFiles} files (processed {$nClassesTotal} classes in {$nFilesTotal} files)\n"; } function getPhpDocForDir($dirName) { global $nFiles, $nFilesTotal; $phpdocDir = ""; $files = new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirName)), '#^.+\\.php$#i', RecursiveRegexIterator::GET_MATCH); foreach ($files as $file) { $phpdocFile = getPhpDocForFile($file[0]); if ($phpdocFile != "") { $phpdocDir .= "\n[ " . $file[0] . " ]\n"; $phpdocDir .= $phpdocFile; $nFiles++; } $nFilesTotal++; } return $phpdocDir; } function getPhpDocForFile($fileName) { global $nClasses, $nClassesTotal;
<?php $nFiles = 0; $nFilesTotal = 0; $nClasses = 0; $nClassesTotal = 0; file_put_contents(dirname(__FILE__) . '\\phpdoc.txt', getPhpDocForDir('D:\\Web\\libs-dev\\yii\\framework') . getPhpDocStats()); //getPhpDocForDir('D:\Web\libs\yii\framework') . getPhpDocStats()); //echo getPhpDocForDir('D:\Web\libs\yii\framework'); //echo getPhpDocForDir('D:\Web\libs\yii\framework\caching'); //echo getPhpDocForFile('D:\Web\libs\yii\framework\base\CModel.php'); function getPhpDocStats() { global $nFiles, $nFilesTotal, $nClasses, $nClassesTotal; return "\n\nComments for {$nClasses} classes in {$nFiles} files (processed {$nClassesTotal} classes in {$nFilesTotal} files)\n"; } function getPhpDocForDir($dirName) { global $nFiles, $nFilesTotal; $phpdocDir = ""; $files = new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirName)), '#^.+\\.php$#i', RecursiveRegexIterator::GET_MATCH); foreach ($files as $file) { $phpdocFile = getPhpDocForFile($file[0]); if ($phpdocFile != "") { $phpdocDir .= "\n[ " . $file[0] . " ]\n"; $phpdocDir .= $phpdocFile; $nFiles++; } $nFilesTotal++; } return $phpdocDir;