FileGenerator
extends AbstractGenerator
in package
Table of Contents
- LINE_FEED = "\n"
- Line feed to use in place of EOL
- $body : string
- $classes : array<string|int, mixed>
- $declares : array<string|int, DeclareStatement>
- $docBlock : DocBlockGenerator
- $filename : string
- $indentation : int|string
- $isSourceDirty : bool
- $namespace : string
- $requiredFiles : array<string|int, mixed>
- $sourceContent : string
- $uses : array<string|int, mixed>
- __construct() : mixed
- Passes $options to {@link setOptions()}.
- fromArray() : FileGenerator
- fromReflectedFileName() : FileGenerator
- Use this if you intend on generating code generation objects based on the same file.
- fromReflection() : FileGenerator
- generate() : string
- getBody() : string
- getClass() : ClassGenerator
- getClasses() : array<string|int, ClassGenerator>
- getDocBlock() : DocBlockGenerator
- getFilename() : string
- getIndentation() : string
- getNamespace() : string
- getRequiredFiles() : array<string|int, mixed>
- getSourceContent() : string
- 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() : mixed
- setDocBlock() : FileGenerator
- setFilename() : FileGenerator
- setIndentation() : AbstractGenerator
- setNamespace() : FileGenerator
- setOptions() : AbstractGenerator
- setRequiredFiles() : FileGenerator
- setSourceContent() : AbstractGenerator
- setSourceDirty() : AbstractGenerator
- setUse() : FileGenerator
- setUses() : FileGenerator
- write() : FileGenerator
Constants
LINE_FEED
Line feed to use in place of EOL
public
mixed
LINE_FEED
= "\n"
Properties
$body
protected
string
$body
$classes
protected
array<string|int, mixed>
$classes
= []
$declares
protected
array<string|int, DeclareStatement>
$declares
= []
$docBlock
protected
DocBlockGenerator
$docBlock
$filename
protected
string
$filename
$indentation
protected
int|string
$indentation
= ' '
4 spaces by default
$isSourceDirty
protected
bool
$isSourceDirty
= true
$namespace
protected
string
$namespace
$requiredFiles
protected
array<string|int, mixed>
$requiredFiles
= []
$sourceContent
protected
string
$sourceContent
$uses
protected
array<string|int, mixed>
$uses
= []
Methods
__construct()
Passes $options to {@link setOptions()}.
public
__construct([array<string|int, mixed>|Traversable $options = null ]) : mixed
Parameters
- $options : array<string|int, mixed>|Traversable = null
Return values
mixed —fromArray()
public
static fromArray(array<string|int, mixed> $values) : FileGenerator
Parameters
- $values : array<string|int, mixed>
Return values
FileGenerator —fromReflectedFileName()
Use this if you intend on generating code generation objects based on the same file.
public
static fromReflectedFileName(string $filePath[, bool $includeIfNotAlreadyIncluded = true ]) : FileGenerator
This will keep previous changes to the file in tact during the same PHP process
Parameters
- $filePath : string
- $includeIfNotAlreadyIncluded : bool = true
Tags
Return values
FileGenerator —fromReflection()
public
static fromReflection(FileReflection $fileReflection) : FileGenerator
Parameters
- $fileReflection : FileReflection
Return values
FileGenerator —generate()
public
generate() : string
Return values
string —getBody()
public
getBody() : string
Return values
string —getClass()
public
getClass([string $name = null ]) : ClassGenerator
Parameters
- $name : string = null
Return values
ClassGenerator —getClasses()
public
getClasses() : array<string|int, ClassGenerator>
Return values
array<string|int, ClassGenerator> —getDocBlock()
public
getDocBlock() : DocBlockGenerator
Return values
DocBlockGenerator —getFilename()
public
getFilename() : string
Return values
string —getIndentation()
public
getIndentation() : string
Return values
string —getNamespace()
public
getNamespace() : string
Return values
string —getRequiredFiles()
public
getRequiredFiles() : array<string|int, mixed>
Return values
array<string|int, mixed> —getSourceContent()
public
getSourceContent() : string
Return values
string —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
Return values
array<string|int, mixed> —isSourceDirty()
public
isSourceDirty() : bool
Return values
bool —setBody()
public
setBody(string $body) : FileGenerator
Parameters
- $body : string
Return values
FileGenerator —setClass()
public
setClass(array<string|int, mixed>|string|ClassGenerator $class) : FileGenerator
Parameters
- $class : array<string|int, mixed>|string|ClassGenerator
Tags
Return values
FileGenerator —setClasses()
public
setClasses(array<string|int, mixed> $classes) : FileGenerator
Parameters
- $classes : array<string|int, mixed>
Return values
FileGenerator —setDeclares()
public
setDeclares(array<string|int, mixed> $declares) : mixed
Parameters
- $declares : array<string|int, mixed>
Return values
mixed —setDocBlock()
public
setDocBlock(DocBlockGenerator|array<string|int, mixed>|string $docBlock) : FileGenerator
Parameters
- $docBlock : DocBlockGenerator|array<string|int, mixed>|string
Tags
Return values
FileGenerator —setFilename()
public
setFilename(string $filename) : FileGenerator
Parameters
- $filename : string
Return values
FileGenerator —setIndentation()
public
setIndentation(string $indentation) : AbstractGenerator
Parameters
- $indentation : string
Return values
AbstractGenerator —setNamespace()
public
setNamespace(string $namespace) : FileGenerator
Parameters
- $namespace : string
Return values
FileGenerator —setOptions()
public
setOptions(array<string|int, mixed>|Traversable $options) : AbstractGenerator
Parameters
- $options : array<string|int, mixed>|Traversable
Tags
Return values
AbstractGenerator —setRequiredFiles()
public
setRequiredFiles(array<string|int, mixed> $requiredFiles) : FileGenerator
Parameters
- $requiredFiles : array<string|int, mixed>
Return values
FileGenerator —setSourceContent()
public
setSourceContent(string $sourceContent) : AbstractGenerator
Parameters
- $sourceContent : string
Return values
AbstractGenerator —setSourceDirty()
public
setSourceDirty([bool $isSourceDirty = true ]) : AbstractGenerator
Parameters
- $isSourceDirty : bool = true
Return values
AbstractGenerator —setUse()
public
setUse(string $use[, null|string $as = null ]) : FileGenerator
Parameters
- $use : string
- $as : null|string = null
Return values
FileGenerator —setUses()
public
setUses(array<string|int, mixed> $uses) : FileGenerator
Parameters
- $uses : array<string|int, mixed>
Return values
FileGenerator —write()
public
write() : FileGenerator