Constants

CREATE_EMPTY

CREATE_EMPTY

Constant to not use a class or interface

CREATE_CLASS

CREATE_CLASS

Constant to create a class

CREATE_INTERFACE

CREATE_INTERFACE

Constant to create an interface

Properties

$fullpath

$fullpath : string

Full path and name of the file, i.e. '/some/dir/file.ext'

Type

string

$basename

$basename : string

Full basename of file, i.e. 'file.ext'

Type

string

$filename

$filename : string

Full filename of file, i.e. 'file'

Type

string

$extension

$extension : string

File extension, i.e. 'ext'

Type

string

$output

$output : string

File output data.

Type

string

$body

$body : string

Code body

Type

string

$indent

$indent : string

Code indent

Type

string

$close

$close : boolean

Flag to close the code file with ?>

Type

boolean

$allowed

$allowed : array

Array of allowed file types.

Type

array

Methods

__construct()

__construct(string  $file, string  $type = \Pop\Code\Generator::CREATE_EMPTY) 

Constructor

Instantiate the code generator object

Parameters

string $file
string $type

createInterface()

createInterface() : \Pop\Code\Generator

Create a class generator object

Returns

\Pop\Code\Generator

createClass()

createClass() : \Pop\Code\Generator

Create a class generator object

Returns

\Pop\Code\Generator

setCloseTag()

setCloseTag(boolean  $close = false) : \Pop\Code\Generator

Set the code close tag flag

Parameters

boolean $close

Returns

\Pop\Code\Generator

hasCloseTag()

hasCloseTag() : boolean

Get the code close tag flag

Returns

boolean

setIndent()

setIndent(string  $indent = null) : \Pop\Code\Generator

Set the code indent

Parameters

string $indent

Returns

\Pop\Code\Generator

getIndent()

getIndent() : string

Get the code indent

Returns

string

setBody()

setBody(string  $body, boolean  $newline = true) : \Pop\Code\Generator

Set the code body

Parameters

string $body
boolean $newline

Returns

\Pop\Code\Generator

appendToBody()

appendToBody(string  $body, boolean  $newline = true) : \Pop\Code\Generator

Append to the code body

Parameters

string $body
boolean $newline

Returns

\Pop\Code\Generator

getBody()

getBody() : string

Get the method body

Returns

string

getFullpath()

getFullpath() : string

Get the fullpath

Returns

string

read()

read(integer|string  $off = null, integer|string  $len = null) : string

Read data from the code file.

Parameters

integer|string $off
integer|string $len

Returns

string

render()

render(boolean  $ret = false) : mixed

Render method

Parameters

boolean $ret

Returns

mixed

output()

output(boolean  $download = false) : \Pop\Code\Generator

Output the code object directly.

Parameters

boolean $download

Returns

\Pop\Code\Generator

save()

save(string  $to = null, boolean  $append = false) : \Pop\Code\Generator

Save the code object to disk.

Parameters

string $to
boolean $append

Returns

\Pop\Code\Generator

__toString()

__toString() : string

Print code

Returns

string