NamespaceGenerator
extends AbstractGenerator
in package
Uses
NameTrait, DocblockTrait, UseTrait
Namespace generator class
Tags
Table of Contents
Properties
- $docblock : DocblockGenerator|null
- Docblock generator object
- $indent : int
- Code indent spaces
- $name : string|null
- Name
- $output : string|null
- Output string
- $uses : array<string|int, mixed>
- Array of namespaces to use
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Print namespace
- addUse() : static
- Add a namespace to use
- addUses() : static
- Add namespaces to use
- getDesc() : string|null
- Get the docblock description
- getDocblock() : DocblockGenerator|null
- Access the docblock generator object
- getIndent() : int
- Get the indent
- getName() : string|null
- 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() : static
- Set the docblock description
- setDocblock() : static
- Set the docblock generator object
- setIndent() : AbstractGenerator
- Set the indent
- setName() : static
- Set the name
Properties
$docblock
Docblock generator object
protected
DocblockGenerator|null
$docblock
= null
$indent
Code indent spaces
protected
int
$indent
= 4
$name
Name
protected
string|null
$name
= null
$output
Output string
protected
string|null
$output
= null
$uses
Array of namespaces to use
protected
array<string|int, mixed>
$uses
= []
Methods
__construct()
Constructor
public
__construct([string|null $namespace = null ][, int $indent = 0 ]) : mixed
Instantiate the namespace generator object
Parameters
- $namespace : string|null = null
- $indent : int = 0
__toString()
Print namespace
public
__toString() : string
Return values
stringaddUse()
Add a namespace to use
public
addUse(string $use[, string|null $as = null ]) : static
Parameters
- $use : string
- $as : string|null = null
Return values
staticaddUses()
Add namespaces to use
public
addUses(array<string|int, mixed> $uses) : static
Parameters
- $uses : array<string|int, mixed>
Return values
staticgetDesc()
Get the docblock description
public
getDesc() : string|null
Return values
string|nullgetDocblock()
Access the docblock generator object
public
getDocblock() : DocblockGenerator|null
Return values
DocblockGenerator|nullgetIndent()
Get the indent
public
getIndent() : int
Return values
intgetName()
Get the name
public
getName() : string|null
Return values
string|nullgetOutput()
Get the output
public
getOutput() : string
Return values
stringgetUses()
Get uses
public
getUses() : array<string|int, mixed>
Return values
array<string|int, mixed>hasDesc()
Has a docblock description
public
hasDesc() : bool
Return values
boolhasDocblock()
Has docblock generator object
public
hasDocblock() : bool
Return values
boolhasIndent()
Has indent
public
hasIndent() : bool
Return values
boolhasName()
Get the name
public
hasName() : bool
Return values
boolhasOutput()
Has output
public
hasOutput() : bool
Return values
boolhasUse()
Has use
public
hasUse(string $use) : bool
Parameters
- $use : string
Return values
boolhasUses()
Has uses
public
hasUses() : bool
Return values
boolisRendered()
Is rendered (alias to hasOutput())
public
isRendered() : bool
Return values
boolprintIndent()
Print the indent
public
printIndent() : string
Return values
stringrender()
Render namespace
public
render() : string
Return values
stringsetDesc()
Set the docblock description
public
setDesc([string|null $desc = null ]) : static
Parameters
- $desc : string|null = null
Return values
staticsetDocblock()
Set the docblock generator object
public
setDocblock(DocblockGenerator $docblock) : static
Parameters
- $docblock : DocblockGenerator
Return values
staticsetIndent()
Set the indent
public
setIndent(int $indent) : AbstractGenerator
Parameters
- $indent : int
Return values
AbstractGeneratorsetName()
Set the name
public
setName(string $name) : static
Parameters
- $name : string