PHP Class Pop\Code\Generator\DocblockGenerator

Author: Nick Sagona, III ([email protected])
Inheritance: implements Pop\Code\Generator\GeneratorInterface
Show file Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$desc string Docblock description
$indent string Docblock indent
$output string Docblock output
$tags array Docblock tags

Public Methods

Method Description
__construct ( string $desc = null, string $indent = null ) : DocblockGenerator Constructor
__toString ( ) : string Print docblock
factory ( string $desc = null, string $indent = null ) : DocblockGenerator Static method to instantiate the docblock object and return itself to facilitate chaining methods together.
getDesc ( ) : string Get the docblock description
getIndent ( ) : string Get the docblock indent
getParam ( integer $index ) : array Get a param
getReturn ( ) : array Get the return
getTag ( string $name ) : string Get a tag
parse ( string $docblock, string $forceIndent = null ) : DocblockGenerator Static method to parse a docblock string and return a new docblock generator object.
render ( boolean $ret = false ) : mixed Render docblock
setDesc ( string $desc = null ) : DocblockGenerator Set the docblock description
setIndent ( string $indent = null ) : DocblockGenerator Set the docblock indent
setParam ( string $type, string $var = null, string $desc = null ) : DocblockGenerator Add a param tag
setParams ( array $params ) : DocblockGenerator Add a param tag
setReturn ( string $type, string $desc = null ) : DocblockGenerator Add a return tag
setTag ( string $name, string $desc = null ) : DocblockGenerator Add a basic tag
setTags ( array $tags ) : DocblockGenerator Add basic tags

Protected Methods

Method Description
formatTags ( ) : string Format the docblock tags
getParamLength ( ) : integer Get the longest param type length
getTagLength ( ) : integer Get the longest tag length

Method Details

__construct() public method

Instantiate the docblock generator object
public __construct ( string $desc = null, string $indent = null ) : DocblockGenerator
$desc string
$indent string
return DocblockGenerator

__toString() public method

Print docblock
public __toString ( ) : string
return string

factory() public static method

Static method to instantiate the docblock object and return itself to facilitate chaining methods together.
public static factory ( string $desc = null, string $indent = null ) : DocblockGenerator
$desc string
$indent string
return DocblockGenerator

formatTags() protected method

Format the docblock tags
protected formatTags ( ) : string
return string

getDesc() public method

Get the docblock description
public getDesc ( ) : string
return string

getIndent() public method

Get the docblock indent
public getIndent ( ) : string
return string

getParam() public method

Get a param
public getParam ( integer $index ) : array
$index integer
return array

getParamLength() protected method

Get the longest param type length
protected getParamLength ( ) : integer
return integer

getReturn() public method

Get the return
public getReturn ( ) : array
return array

getTag() public method

Get a tag
public getTag ( string $name ) : string
$name string
return string

getTagLength() protected method

Get the longest tag length
protected getTagLength ( ) : integer
return integer

parse() public static method

Static method to parse a docblock string and return a new docblock generator object.
public static parse ( string $docblock, string $forceIndent = null ) : DocblockGenerator
$docblock string
$forceIndent string
return DocblockGenerator

render() public method

Render docblock
public render ( boolean $ret = false ) : mixed
$ret boolean
return mixed

setDesc() public method

Set the docblock description
public setDesc ( string $desc = null ) : DocblockGenerator
$desc string
return DocblockGenerator

setIndent() public method

Set the docblock indent
public setIndent ( string $indent = null ) : DocblockGenerator
$indent string
return DocblockGenerator

setParam() public method

Add a param tag
public setParam ( string $type, string $var = null, string $desc = null ) : DocblockGenerator
$type string
$var string
$desc string
return DocblockGenerator

setParams() public method

Add a param tag
public setParams ( array $params ) : DocblockGenerator
$params array
return DocblockGenerator

setReturn() public method

Add a return tag
public setReturn ( string $type, string $desc = null ) : DocblockGenerator
$type string
$desc string
return DocblockGenerator

setTag() public method

Add a basic tag
public setTag ( string $name, string $desc = null ) : DocblockGenerator
$name string
$desc string
return DocblockGenerator

setTags() public method

Add basic tags
public setTags ( array $tags ) : DocblockGenerator
$tags array
return DocblockGenerator

Property Details

$desc protected property

Docblock description
protected string $desc
return string

$indent protected property

Docblock indent
protected string $indent
return string

$output protected property

Docblock output
protected string $output
return string

$tags protected property

Docblock tags
protected array $tags
return array