I am using doxygen, but it doesn't document some of my classes. All these classes are called in the following way:
<?php
if(!class_exists('a')){
class a{
function b(){
print 'c';
}
}
}
?>
I assume it has to do with if(!class_exists('a')), how can i let doxygen still document this?
Doxygen has many issues documenting php code. And many of them can be corrected by using an input_filter
.
Use the following code as filter
<?php
$source = file_get_contents($argv[1]);
$regexp = '#(<\?php[\s]+)(if\(!class_exists\([^\)]+\)\)\{)([\s\S]*)(\})([\s]*\?>)#';
$replace = '$1 $3 $5';
$source = preg_replace($regexp, $replace, $source);
echo $source;
?>
and enter it as
/path/to/php php_var_filter.php
into the INPUT_FILTER
setting.
Notice: This way you can fix many doxygen issues. If something does not work, it is beacause of a difference between c (or c++) code to php code (most likly). You can use the input_filter to change your php code to look more like c code. This will fix many problems.
Edit
Maybe you also want to think about an autoload function. I think this is a better way to get the if(!class_exists(..))
-result.
Edit
I just noticed I already answerd a similar question different. You can also use this answer.
You can find some more input filters to improve doxygen's php support on GitHub.