Documentation

FileGenerator extends AbstractGenerator
in package

Table of Contents

Constants

LINE_FEED  = "\n"
Line feed to use in place of EOL

Properties

$body  : string
$classes  : array<string|int, ClassGenerator>
$declares  : array<string|int, DeclareStatement>
$docBlock  : DocBlockGenerator|null
$filename  : string
$indentation  : string
$isSourceDirty  : bool
$namespace  : string
$requiredFiles  : array<string|int, string>
$sourceContent  : string|null
TODO: Type should be changed to "string" in the next major version. Nullable for BC
$uses  : array<string|int, mixed>

Methods

__construct()  : mixed
Passes $options to {@link setOptions()}.
fromArray()  : FileGenerator
generate()  : string
getBody()  : string
getClass()  : ClassGenerator
getClasses()  : array<string|int, ClassGenerator>
getDocBlock()  : DocBlockGenerator|null
getFilename()  : string
getIndentation()  : string
getNamespace()  : string
getRequiredFiles()  : array<string|int, string>
getSourceContent()  : string|null
getUses()  : array<string|int, mixed>
Returns an array with the first element the use statement, second is the as part.
isSourceDirty()  : bool
setBody()  : FileGenerator
setClass()  : FileGenerator
setClasses()  : FileGenerator
setDeclares()  : static
setDocBlock()  : FileGenerator
setFilename()  : FileGenerator
setIndentation()  : AbstractGenerator
setNamespace()  : FileGenerator
setOptions()  : AbstractGenerator
setRequiredFiles()  : FileGenerator
setSourceContent()  : AbstractGenerator
setSourceDirty()  : AbstractGenerator
setUse()  : FileGenerator
setUses()  : FileGenerator
write()  : FileGenerator

Constants

Properties

$requiredFiles

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

$sourceContent

TODO: Type should be changed to "string" in the next major version. Nullable for BC

protected string|null $sourceContent = null

$uses

protected array<string|int, mixed> $uses = []
Tags
psalm-var

list<array{string, string|null}>

Methods

__construct()

Passes $options to {@link setOptions()}.

public __construct([array<string|int, mixed>|Traversable|null $options = null ]) : mixed
Parameters
$options : array<string|int, mixed>|Traversable|null = null

getFilename()

public getFilename() : string
Return values
string

getNamespace()

public getNamespace() : string
Return values
string

getRequiredFiles()

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

getSourceContent()

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

getUses()

Returns an array with the first element the use statement, second is the as part.

public getUses([bool $withResolvedAs = false ]) : array<string|int, mixed>

If $withResolvedAs is set to true, there will be a third element that is the "resolved" as statement, as the second part is not required in use statements

Parameters
$withResolvedAs : bool = false
Tags
psalm-return

array<int, array{string, null|string, false|null|string}>

Return values
array<string|int, mixed>

isSourceDirty()

public isSourceDirty() : bool
Return values
bool

        
On this page

Search results