Phpdoc
Download
1 / 23

phpdoc - PowerPoint PPT Presentation


  • 255 Views
  • Updated On :

PHPDoc. By: Ana Marie Chanaba & Joseph Casabona. Overview. Introduction: What is PHPDoc The Installation Process Online Resources Initializing PHPDoc Hard Coding Web Interface. Overview- cont. Documenting the Code DocBlock Templates Observations Conclusion. What is PHPDoc?.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'phpdoc' - Thomas


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Phpdoc l.jpg

PHPDoc

By: Ana Marie Chanaba & Joseph Casabona


Overview l.jpg
Overview

  • Introduction: What is PHPDoc

  • The Installation Process

    • Online Resources

  • Initializing PHPDoc

    • Hard Coding

    • Web Interface


Overview cont l.jpg
Overview- cont.

  • Documenting the Code

  • DocBlock Templates

  • Observations

  • Conclusion


What is phpdoc l.jpg
What is PHPDoc?

  • PHPDoc is an adaptation of JavaDoc for PHP. It is a widely easy-to-use documentation generator for PHP code

  • Uses PHP Objects to generate documentation

  • PHPDocumentor

  • DocBlocks


Installing phpdoc l.jpg
Installing PHPDoc

  • Download PHPDoc

    • http://www.phpdoc.de/

    • Sourceforge.net

      http://sourceforge.net/project/showfiles.php?group_id=11194


Installing the web interface l.jpg
Installing the Web Interface

  • To use the web interface, you must have a web server such as Apache installed, and must have a working PHP for that web server.


Apache server l.jpg
Apache Server

If developers want to use PHPDoc's web interface, they simply have to unzip the archive and put it into the directory that is appended onto the user’s home directory.

UserDir "My Documents/unix_web"


Installation l.jpg
Installation

  • The default for extracting PHPDoc is “C:\My Documents\unix_web\phpdoc”.

  • You should now be able to get to the PHPDoc interface by querying

    http://localhost/~username/phpdoc/PphDocumentor.







Initializing phpdoc l.jpg
Initializing PHPDoc

  • Hard Code Initialization

    • Initialize PHPDoc Objects

      define("PHPDOC_INCLUDE_DIR", "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/PHPDoc/");

      define("LINEBREAK", "\r\n");

      include("PHPDoc/prepend.php");

      $doc = new Phpdoc;

      $doc->setApplication("Joe's Resume");

      $doc->setSourceDirectory(PHPDOC_INCLUDE_DIR);

      $doc->setTarget(PHPDOC_INCLUDE_DIR."apidoc/resume/");

      $doc->setTemplateDirectory(PHPDOC_INCLUDE_DIR."renderer/html/templates/");

      $doc->setSourceFileSuffix( array ("php", "inc") );


Initializing phpdoc15 l.jpg
Initializing PHPDoc

  • Hard Coding- cont.

    • Two lines to render documentation

      $doc->parse();

      $doc->render();


Documenting the code l.jpg
Documenting the Code

  • All source code should contain a "page-level" docblock at the top of each file and a "class-level" docblock immediately above each class.

    • /** begins a DocBlock

    • **/ ends a DocBlock


Documenting the code17 l.jpg
Documenting the Code

  • * must be at the beginning of a line within a DocBlock

  • @ is a special way to start the DocBlock Line


Documenting the code18 l.jpg
Documenting the Code

  • Sample Function:

    /**

    * A sample function docblock

    * @global string document the fact that this function uses $_myvar

    * @staticvar integer $staticvar this is actually what is returned

    * @param string $param1 name to declare

    * @param string $param2 value of the name

    * @return integer

    */

    function firstFunc($param1, $param2 = 'optional')

    {

    static $staticvar = 7;

    global $_myvar;

    return $staticvar;

    }


Docblock templates l.jpg
DocBlock Templates

  • PHPDoc allows developers to reduce unneeded typing by using DocBlock templates


Before docblock template l.jpg
Before DocBlock Template

class Bob

{

     // beginning of docblock template area

         /**#@+

     [email protected]

      [email protected]

     */

     var $_var1 = 'hello';

     var $_var2 = 'my';    

     /**

      * Two words

      */

     var $_var8 = 'like strings';

     /**#@-*/

     var $publicvar = 'Lookee me!';

}


After docblock template l.jpg
After DocBlock Template

class Bob

{

    // beginning of docblock template area

          /**

      [email protected]

      [email protected]

      */

     var $_var1 = 'hello';

     /**

     [email protected]

     [email protected]

      */

     var $_var2 = 'my';

     /**

       [email protected]

      [email protected]

      */

/**

   * Two words

    */

     var $_var8 = 'like strings';

     var $publicvar = 'Lookee me!';

}


Observations l.jpg
Observations

  • PHPDoc great for documenting functions and classes

  • Makes page run slower

    • A lot of overhead

  • PHPDoc documentation generated each time


Conclusion l.jpg
Conclusion

  • Documentation needed in coding

  • PHPDoc is easy to use, fairly straight forward

    • Generates extensive code based on comments