Doxygen不记录php代码里面的标签 [英] Doxygen not documenting php code inside if tags

查看:115
本文介绍了Doxygen不记录php代码里面的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是doxygen,但是它没有记录我的一些类。所有这些类都通过以下方式调用:

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';
        }
    }
}
?>

我假设它与if(!class_exists('a'))有关,我怎么能让doxygen还记录这个?

I assume it has to do with if(!class_exists('a')), how can i let doxygen still document this?

推荐答案

Doxygen有许多问题记录PHP代码。其中许多可以通过使用 input_filter 来更正。

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;
?>

并输入为

/path/to/php php_var_filter.php

INPUT_FILTER 设置。

注意:这样,您可以修复许多d​​oxygen问题。如果某些事情不起作用,那么c(或c ++)代码与php代码(最可能)之间的区别是令人讨厌的。你可以使用input_filter来更改你的php代码,看起来更像是c代码。这将解决许多问题。

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.

修改

也许你也想考虑一个自动加载功能。我认为这是一个更好的方法来获取 if(!class_exists(..)) -result。

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.

编辑
我刚刚注意到我已经回答了类似的问题。您也可以使用此答案

您可以找到一些更多的输入过滤器可以改善 GitHub 上的doxygen的PHP支持。

You can find some more input filters to improve doxygen's php support on GitHub.

这篇关于Doxygen不记录php代码里面的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆