Nɪsʜᴀɴᴛʜ ॐ
Nɪsʜᴀɴᴛʜ ॐ

Reputation: 2904

An Issue with automatic code documentation | PHP

I'm having a CodeIgniter project with lots of modules and codes residing in it.

Now I would like to create documentation for other new co-workers.

For example

/**
 * inline tags demonstration
 *
 * This class generates bars using the main algorithm, which also 
 * works heavily with {@link foo()} to rule the world. If I want
 * to use the characters "{@link" in a docblock, I just use "{@}link."  If
 * I want the characters "{@*}" I use "{@}*}"
 *
 * @author ahobbit
 * @copyright middleearth.org XVII
 * @version 1.2.3
 */
class bar
{
    // beginning of docblock template area
    /**#@+
    * @access private
    * @var string
    */
    var $_var1 = 'hello';
    var $_var2 = 'my';
    var $_var3 = 'name';
    var $_var4 = 'is';
    var $_var5 = 'Bob';
    var $_var6 = 'and';
    var $_var7 = 'I';
    /**
    * Two words
    */
    var $_var8 = 'like strings';
    /**#@-*/
    var $publicvar = 'Lookee me!';
}

/**
 * Makes chocolate bars
 *
 * There are two aspects to this class.
 * {@inheritdoc }  In addition, the foo class
 * makes the bars chocolate
 */
class foo extends bar
{

    /**
    * Check if a Sql row exists. (with two values)
    *
    * This function will check if a selected sql row exists that contains two
    * known values.
    *
    * @param  string  $tblname  Sql Table Name
    * @param  string  $colname  Sql Column Name 1
    * @param  string  $value    Sql value 1
    * @param  string  $colname2 Sql Column Name 2
    * @param  string  $value2   Sql value 2
    * @return boolean           returns true if the sql row does exist
    */
    function tableHasRow2D($tblname, $colname, $value, $colname2, $value2) { 
        $row = sqlQuery("SELECT COUNT(*) AS count FROM $tblname WHERE " . "$colname 
            LIKE '$value' AND $colname2 LIKE '$value2'"); 
        return $row['count'] ? true : false; 
    } 
}

I had made use of with the following commands

I. PHPdoc

E:\xampp\htdocs\CI_Proj> php phpDocumentor.phar -d application

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in phar://E:/xampp/htdocs/CI_Proj/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293
  Execute transformation using writer "twig"
  Execute transformation using writer "twig"
  Execute transformation using writer "twig"
  Execute transformation using writer "twig"
  Execute transformation using writer "twig"
  Execute transformation using writer "Graph"
Unable to find the `dot` command of the GraphViz package. Is GraphViz correctly installed and present in your path? 222.041s
Analyze results and write a report to log 

                       ..    0.004s

enter image description here


II. ApiGen

E:\xampp\htdocs\CI_Proj\vendor\bin>apigen generate src "E:\xampp\htdocs\CI_Proj\application" --destination "E:\xampp\htdocs\CI_Proj\docs-apigen" --debug

Fatal error: Cannot use 'Object' as class name as it is reserved in E:\xampp\htdocs\CI_Proj\vendor\latte\latte\src\Latte\Object.php on line 14
ErrorException: Cannot use 'Object' as class name as it is reserved in E:\xampp\htdocs\CI_Proj\vendor\latte\latte\src\Latte\Object.php:14
Stack trace:
#0 [internal function]: Tracy\Debugger::shutdownHandler()
#1 {main}
Unable to log error: Logging directory is not specified.

Is it be possible to add comments to the modules before or after generation of code? Since I'm looking to add comments to specific modules in the document itself and optionally that would automatically inserted to the source code, at the right positions.

How should I need to manage the modules and code inside the project and How would I create a browsable HTML-Documentation?

Any other tool that makes generating the documentation directly from your PHP source code, that would be great in advice

Upvotes: 0

Views: 259

Answers (0)

Related Questions