Documentation

Generator extends AbstractGenerator
in package
Uses DocblockTrait

Generator code class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2021 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.1.0

Table of Contents

$close  : bool
Flag to close the code file with ?>
$code  : array<string|int, mixed>
Code generator objects
$docblock  : DocblockGenerator
Docblock generator object
$env  : string
Environment setting, i.e. #!/usr/bin/php
$filename  : string
Code filename
$indent  : int
Code indent spaces
$namespaces  : array<string|int, mixed>
Namespaces for the code generator objects
$output  : string
Output string
__construct()  : mixed
Constructor
__toString()  : string
Print code
addCodeObject()  : Generator
Add a code generator object
addCodeObjects()  : Generator
Add code generator objects
code()  : array<string|int, mixed>
Access the code generator objects (alias method)
getCode()  : array<string|int, mixed>
Access the code generator object
getDesc()  : string
Get the docblock description
getDocblock()  : DocblockGenerator
Access the docblock generator object
getEnv()  : string
Get the environment
getFilename()  : string
Get filename
getIndent()  : int
Get the indent
getOutput()  : string
Get the output
hasCloseTag()  : bool
Determine if the code close tag flag is set
hasCode()  : bool
Has code generator objects
hasDesc()  : bool
Has a docblock description
hasDocblock()  : bool
Has docblock generator object
hasEnv()  : bool
Determine if the environment is set
hasFilename()  : bool
Has filename
hasIndent()  : bool
Has indent
hasOutput()  : bool
Has output
isRendered()  : bool
Is rendered (alias to hasOutput())
outputToHttp()  : void
Output to HTTP
printIndent()  : string
Print the indent
render()  : string
Render method
setCloseTag()  : Generator
Set the code close tag flag
setDesc()  : DocblockTrait
Set the docblock description
setDocblock()  : DocblockTrait
Set the docblock generator object
setEnv()  : Generator
Set the environment
setFilename()  : Generator
Set the filename
setIndent()  : AbstractGenerator
Set the indent
writeToFile()  : void
Write to file

Properties

$close

Flag to close the code file with ?>

protected bool $close = false

$code

Code generator objects

protected array<string|int, mixed> $code = []

$env

Environment setting, i.e. #!/usr/bin/php

protected string $env = null

$filename

Code filename

protected string $filename = null

$namespaces

Namespaces for the code generator objects

protected array<string|int, mixed> $namespaces = []

Methods

__construct()

Constructor

public __construct([mixed $code = null ]) : mixed

Instantiate the code generator object

Parameters
$code : mixed = null
Tags
throws
Exception
Return values
mixed

__toString()

Print code

public __toString() : string
Return values
string

addCodeObjects()

Add code generator objects

public addCodeObjects(array<string|int, mixed> $codeObjects) : Generator
Parameters
$codeObjects : array<string|int, mixed>
Return values
Generator

code()

Access the code generator objects (alias method)

public code() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCode()

Access the code generator object

public getCode() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDesc()

Get the docblock description

public getDesc() : string
Return values
string

getEnv()

Get the environment

public getEnv() : string
Return values
string

getFilename()

Get filename

public getFilename() : string
Return values
string

getOutput()

Get the output

public getOutput() : string
Return values
string

hasCloseTag()

Determine if the code close tag flag is set

public hasCloseTag() : bool
Return values
bool

hasCode()

Has code generator objects

public hasCode() : bool
Return values
bool

hasDesc()

Has a docblock description

public hasDesc() : bool
Return values
bool

hasDocblock()

Has docblock generator object

public hasDocblock() : bool
Return values
bool

hasEnv()

Determine if the environment is set

public hasEnv() : bool
Return values
bool

hasFilename()

Has filename

public hasFilename() : bool
Return values
bool

isRendered()

Is rendered (alias to hasOutput())

public isRendered() : bool
Return values
bool

outputToHttp()

Output to HTTP

public outputToHttp([string $filename = null ][, bool $forceDownload = false ][, array<string|int, mixed> $headers = [] ]) : void
Parameters
$filename : string = null
$forceDownload : bool = false
$headers : array<string|int, mixed> = []
Return values
void

printIndent()

Print the indent

public printIndent() : string
Return values
string

render()

Render method

public render() : string
Return values
string

setCloseTag()

Set the code close tag flag

public setCloseTag([bool $close = false ]) : Generator
Parameters
$close : bool = false
Return values
Generator

setEnv()

Set the environment

public setEnv([string $env = null ]) : Generator
Parameters
$env : string = null
Return values
Generator

setFilename()

Set the filename

public setFilename(string $filename) : Generator
Parameters
$filename : string
Return values
Generator

writeToFile()

Write to file

public writeToFile([string $filename = null ]) : void
Parameters
$filename : string = null
Tags
throws
Exception
Return values
void

Search results