PHP_DocBlockGenerator
[ class tree: PHP_DocBlockGenerator ] [ index: PHP_DocBlockGenerator ] [ all elements ]

Class: PHP_DocBlockGenerator

Source Location: /PHP_DocBlockGenerator-1.1.2/PHP/DocBlockGenerator.php

Class Overview


Creation of Documentation blocks or DocBlocks in a PHP file


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2007 Michel Corne

Methods


Inherited Variables

Inherited Methods


Class Details

[line 98]
Creation of Documentation blocks or DocBlocks in a PHP file

Creates the file Page block and the DocBlocks for includes, global variables, functions, parameters, classes, constants, properties and methods. Accepts parameters to set the category name, the package name, the author's name and email, the license, the package link, etc... Attempts to guess variable and parameters types. Aligns the DocBlock tags. Tags are not updated or added to existing DocBlocks but only realigned.

The package can be run by: calling the "PHP_DocBlockGenerator" class, or by running the "docblockgen" DOS/Unix command.

 Example 1: Creates DocBlocks in foo.php with default license, package name, etc...
 $docblockgen = new PHP_DocBlockGenerator();
 $docblockgen->generate('foo.php');

 Example 2: Creates Docblocks for foo.php in docfoo.php with some specific Page tags
 $param = array('license' => 'apache20', 'category' => 'PHP',
 'author' => 'John Foo', 'email' => 'jfoo@mail.com', 'year' => '1999-2007');
 $docblockgen = new PHP_DocBlockGenerator();
 $docblockgen->generate('foo.php', $param, 'docfoo.php');

 Example 3: Realigns DocBlock tags
 #docblockgen -A foo.php

 Example 4: Creates Docblocks for foo.php in docfoo.php with some specific Page tags
 #docblockgen -la -c PHP -a "John Foo" -e 'jfoo@mail.com' -y 1999-2007 foo.php docfoo.php



[ Top ]


Method Detail

__construct (Constructor)   [line 114]

void __construct( )

The class constructor
  • Access: public

[ Top ]

generate   [line 146]

boolean generate( string $infile, [array $param = array()], [string $outfile = ''])

Generates the DocBlocks

Reads the input file. Creates and aligns the DocBlocks. Writes the ouput file. The license name is expected to be a key of the self::$license property, otherwise it is silently ignored. The parameters are optional. Their default values is documented in the command usage property self::$cliUsage

  • Return: true on success, false on failure
  • See: PHP_DocBlockGenerator_License::$license, PHP_DocBlockGenerator_Block::$pageTagDefaults
  • Access: public

Parameters:

string   $infile   —  the input file name
array   $param   —  the parameters/options
                          author => "the author's name",
                          category => 'the category name'
                          email => "the author's email"
                          license => apache20 | bsd | lgpl21 | mit | php301,
                          link => 'the package link',
                          package => 'the package name',
                          see => 'a reference to other things',
                          version => 'the file version',
                          year => 'the copy right year'
string   $outfile   —  the output file name, default: the input file name

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:46:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.