Zend Framework  3.0
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
FileGenerator Class Reference

Public Member Functions

 __construct ($options=null)
 Passes $options to setOptions().
 
 setDocBlock ($docBlock)
 
 getDocBlock ()
 
 setRequiredFiles (array $requiredFiles)
 
 getRequiredFiles ()
 
 getNamespace ()
 
 setNamespace ($namespace)
 
 getUses ($withResolvedAs=false)
 Returns an array with the first element the use statement, second is the as part.
 
 setUses (array $uses)
 
 setUse ($use, $as=null)
 
 setClasses (array $classes)
 
 getClass ($name=null)
 
 setClass ($class)
 
 setFilename ($filename)
 
 getFilename ()
 
 getClasses ()
 
 setBody ($body)
 
 getBody ()
 
 isSourceDirty ()
 
 generate ()
 
 write ()
 
- Public Member Functions inherited from AbstractGenerator
 __construct ($options=[])
 
 setSourceDirty ($isSourceDirty=true)
 
 isSourceDirty ()
 
 setIndentation ($indentation)
 
 getIndentation ()
 
 setSourceContent ($sourceContent)
 
 getSourceContent ()
 
 setOptions ($options)
 

Static Public Member Functions

static fromReflectedFileName ($filePath, $includeIfNotAlreadyIncluded=true)
 Use this if you intend on generating code generation objects based on the same file.
 
static fromReflection (FileReflection $fileReflection)
 
static fromArray (array $values)
 

Protected Attributes

 $filename = null
 
 $docBlock = null
 
 $requiredFiles = []
 
 $namespace = null
 
 $uses = []
 
 $classes = []
 
 $body = null
 
- Protected Attributes inherited from AbstractGenerator
 $isSourceDirty = true
 
 $indentation = ' '
 
 $sourceContent = null
 

Additional Inherited Members

- Public Attributes inherited from AbstractGenerator
const LINE_FEED = "\n"
 Line feed to use in place of EOL.
 

Constructor & Destructor Documentation

__construct (   $options = null)

Passes $options to setOptions().

Parameters
array | \Traversable$options

Member Function Documentation

static fromArray ( array  $values)
static
Parameters
array$values
Returns
FileGenerator
static fromReflectedFileName (   $filePath,
  $includeIfNotAlreadyIncluded = true 
)
static

Use this if you intend on generating code generation objects based on the same file.

This will keep previous changes to the file in tact during the same PHP process

Parameters
string$filePath
bool$includeIfNotAlreadyIncluded
Exceptions
ReflectionException\InvalidArgumentExceptionIf file does not exists
ReflectionException\RuntimeExceptionIf file exists but is not included or required
Returns
FileGenerator
static fromReflection ( FileReflection  $fileReflection)
static
Parameters
FileReflection$fileReflection
Returns
FileGenerator
generate ( )
Returns
string

Implements GeneratorInterface.

getBody ( )
Returns
string
getClass (   $name = null)
Parameters
string$name
Returns
ClassGenerator
getClasses ( )
Returns
ClassGenerator[]
getDocBlock ( )
getFilename ( )
Returns
string
getNamespace ( )
Returns
string
getRequiredFiles ( )
Returns
array
getUses (   $withResolvedAs = false)

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

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
bool$withResolvedAs
Returns
array
isSourceDirty ( )
Returns
bool
setBody (   $body)
Parameters
string$body
Returns
FileGenerator
setClass (   $class)
Parameters
array | string | ClassGenerator$class
Exceptions
Exception\InvalidArgumentException
Returns
FileGenerator
setClasses ( array  $classes)
Parameters
array$classes
Returns
FileGenerator
setDocBlock (   $docBlock)
Parameters
DocBlockGenerator | array | string$docBlock
Exceptions
Exception\InvalidArgumentException
Returns
FileGenerator
setFilename (   $filename)
Parameters
string$filename
Returns
FileGenerator
setNamespace (   $namespace)
Parameters
string$namespace
Returns
FileGenerator
setRequiredFiles ( array  $requiredFiles)
Parameters
array$requiredFiles
Returns
FileGenerator
setUse (   $use,
  $as = null 
)
Parameters
string$use
null | string$as
Returns
FileGenerator
setUses ( array  $uses)
Parameters
array$uses
Returns
FileGenerator
write ( )
Returns
FileGenerator
Exceptions
Exception\RuntimeException

Member Data Documentation

$body = null
protected
$classes = []
protected
$docBlock = null
protected
$filename = null
protected
$namespace = null
protected
$requiredFiles = []
protected
$uses = []
protected