NamespaceGenerator
extends AbstractGenerator
in package
Uses
NameTrait, DocblockTrait, UseTrait
Namespace generator class
Tags
Table of Contents
- $docblock : DocblockGenerator
- Docblock generator object
- $indent : int
- Code indent spaces
- $name : string
- Name
- $output : string
- Output string
- $uses : array<string|int, mixed>
- Array of namespaces to use
- __construct() : mixed
- Constructor
- __toString() : string
- Print namespace
- addUse() : UseTrait
- Add a namespace to use
- addUses() : UseTrait
- Add namespaces to use
- getDesc() : string
- Get the docblock description
- getDocblock() : DocblockGenerator
- Access the docblock generator object
- getIndent() : int
- Get the indent
- getName() : string
- Get the name
- getOutput() : string
- Get the output
- getUses() : array<string|int, mixed>
- Get uses
- hasDesc() : bool
- Has a docblock description
- hasDocblock() : bool
- Has docblock generator object
- hasIndent() : bool
- Has indent
- hasName() : bool
- Get the name
- hasOutput() : bool
- Has output
- hasUse() : bool
- Has use
- hasUses() : bool
- Has uses
- isRendered() : bool
- Is rendered (alias to hasOutput())
- printIndent() : string
- Print the indent
- render() : string
- Render namespace
- setDesc() : DocblockTrait
- Set the docblock description
- setDocblock() : DocblockTrait
- Set the docblock generator object
- setIndent() : AbstractGenerator
- Set the indent
- setName() : NameTrait
- Set the name
Properties
$docblock
Docblock generator object
protected
DocblockGenerator
$docblock
= null
$indent
Code indent spaces
protected
int
$indent
= 4
$name
Name
protected
string
$name
= null
$output
Output string
protected
string
$output
= null
$uses
Array of namespaces to use
protected
array<string|int, mixed>
$uses
= []
Methods
__construct()
Constructor
public
__construct([string $namespace = null ], int $indent) : mixed
Instantiate the namespace generator object
Parameters
- $namespace : string = null
- $indent : int
Return values
mixed —__toString()
Print namespace
public
__toString() : string
Return values
string —addUse()
Add a namespace to use
public
addUse(string $use[, string $as = null ]) : UseTrait
Parameters
- $use : string
- $as : string = null
Return values
UseTrait —addUses()
Add namespaces to use
public
addUses(array<string|int, mixed> $uses) : UseTrait
Parameters
- $uses : array<string|int, mixed>
Return values
UseTrait —getDesc()
Get the docblock description
public
getDesc() : string
Return values
string —getDocblock()
Access the docblock generator object
public
getDocblock() : DocblockGenerator
Return values
DocblockGenerator —getIndent()
Get the indent
public
getIndent() : int
Return values
int —getName()
Get the name
public
getName() : string
Return values
string —getOutput()
Get the output
public
getOutput() : string
Return values
string —getUses()
Get uses
public
getUses() : array<string|int, mixed>
Return values
array<string|int, mixed> —hasDesc()
Has a docblock description
public
hasDesc() : bool
Return values
bool —hasDocblock()
Has docblock generator object
public
hasDocblock() : bool
Return values
bool —hasIndent()
Has indent
public
hasIndent() : bool
Return values
bool —hasName()
Get the name
public
hasName() : bool
Return values
bool —hasOutput()
Has output
public
hasOutput() : bool
Return values
bool —hasUse()
Has use
public
hasUse(string $use) : bool
Parameters
- $use : string
Return values
bool —hasUses()
Has uses
public
hasUses() : bool
Return values
bool —isRendered()
Is rendered (alias to hasOutput())
public
isRendered() : bool
Return values
bool —printIndent()
Print the indent
public
printIndent() : string
Return values
string —render()
Render namespace
public
render() : string
Return values
string —setDesc()
Set the docblock description
public
setDesc([string $desc = null ]) : DocblockTrait
Parameters
- $desc : string = null
Return values
DocblockTrait —setDocblock()
Set the docblock generator object
public
setDocblock(DocblockGenerator $docblock) : DocblockTrait
Parameters
- $docblock : DocblockGenerator
Return values
DocblockTrait —setIndent()
Set the indent
public
setIndent(string $indent) : AbstractGenerator
Parameters
- $indent : string
Return values
AbstractGenerator —setName()
Set the name
public
setName(string $name) : NameTrait
Parameters
- $name : string