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-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

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

version
5.0.0

Table of Contents

Properties

$close  : bool
Flag to close the code file with ?>
$code  : array<string|int, mixed>
Code generator objects
$docblock  : DocblockGenerator|null
Docblock generator object
$env  : string|null
Environment setting, i.e. #!/usr/bin/php
$filename  : string|null
Code filename
$indent  : int
Code indent spaces
$namespaces  : array<string|int, mixed>
Namespaces for the code generator objects
$output  : string|null
Output string

Methods

__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|null
Get the docblock description
getDocblock()  : DocblockGenerator|null
Access the docblock generator object
getEnv()  : string|null
Get the environment
getFilename()  : string|null
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()  : static
Set the docblock description
setDocblock()  : static
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|null $env = null

$filename

Code filename

protected string|null $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

__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|null
Return values
string|null

getEnv()

Get the environment

public getEnv() : string|null
Return values
string|null

getFilename()

Get filename

public getFilename() : string|null
Return values
string|null

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|null $filename = null ][, bool $forceDownload = false ][, array<string|int, mixed> $headers = [] ]) : void
Parameters
$filename : string|null = null
$forceDownload : bool = false
$headers : array<string|int, mixed> = []

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

setDesc()

Set the docblock description

public setDesc([string|null $desc = null ]) : static
Parameters
$desc : string|null = null
Return values
static

setEnv()

Set the environment

public setEnv([string|null $env = null ]) : Generator
Parameters
$env : string|null = 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|null $filename = null ]) : void
Parameters
$filename : string|null = null
Tags
throws
Exception

        
On this page

Search results