phpdoc
Download
Skip this Video
Download Presentation
PHPDoc

Loading in 2 Seconds...

play fullscreen
1 / 23

phpdoc - PowerPoint PPT Presentation


  • 261 Views
  • Uploaded 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

PHPDoc

By: Ana Marie Chanaba & Joseph Casabona

overview
Overview
  • Introduction: What is PHPDoc
  • The Installation Process
    • Online Resources
  • Initializing PHPDoc
    • Hard Coding
    • Web Interface
overview cont
Overview- cont.
  • Documenting the Code
  • DocBlock Templates
  • Observations
  • Conclusion
what is phpdoc
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
Installing PHPDoc
  • Download PHPDoc
    • http://www.phpdoc.de/
    • Sourceforge.net

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

installing the web interface
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
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
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
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
Initializing PHPDoc
  • Hard Coding- cont.
    • Two lines to render documentation

$doc->parse();

$doc->render();

documenting the code
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
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
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
DocBlock Templates
  • PHPDoc allows developers to reduce unneeded typing by using DocBlock templates
before docblock template
Before DocBlock Template

class Bob

{

     // beginning of docblock template area

         /**#@+

     * @access private

      * @var string 

     */

     var $_var1 = \'hello\';

     var $_var2 = \'my\';    

     /**

      * Two words

      */

     var $_var8 = \'like strings\';

     /**#@-*/

     var $publicvar = \'Lookee me!\';

}

after docblock template
After DocBlock Template

class Bob

{

    // beginning of docblock template area

          /**

      * @access private

      * @var string 

      */

     var $_var1 = \'hello\';

     /**

      * @access private

      * @var string 

      */

     var $_var2 = \'my\';

     /**

       * @access private

      * @var string 

      */

/**

   * Two words

    */

     var $_var8 = \'like strings\';

     var $publicvar = \'Lookee me!\';

}

observations
Observations
  • PHPDoc great for documenting functions and classes
  • Makes page run slower
    • A lot of overhead
  • PHPDoc documentation generated each time
conclusion
Conclusion
  • Documentation needed in coding
  • PHPDoc is easy to use, fairly straight forward
    • Generates extensive code based on comments