Generates a file with runtime information.

An artifact can register a runtime generator to provide information about its corresponding feature (selected or deselected) at runtime. If used, a suitable PHP class is generated according to the product line's generator settings (see \FeaturePhp\Generator\Settings). (Only PHP is supported as of now.)

package Default
inherited_from \FeaturePhp\Generator\Generator

 Methods

Creates a runtime generator.

__construct(\FeaturePhp\Generator\Settings $settings) 
inherited_from \FeaturePhp\Generator\Generator::__construct()

Parameters

$settings

\FeaturePhp\Generator\Settings

Creates a generator.

__construct(\FeaturePhp\Generator\Settings $settings) 
Inherited

Parameters

$settings

\FeaturePhp\Generator\Settings

Registers an artifact whose corresponding feature is deselected.

addDeselectedArtifact(\FeaturePhp\Artifact\Artifact $artifact) 
Inherited

Parameters

$artifact

\FeaturePhp\Artifact\Artifact

Registers an artifact whose corresponding feature is selected.

addSelectedArtifact(\FeaturePhp\Artifact\Artifact $artifact) 
Inherited

Parameters

$artifact

\FeaturePhp\Artifact\Artifact

Generates the files for all registered artifacts.

generateFiles() : array<mixed,\FeaturePhp\File\File>
Inherited

If the files have already been generated, returns the cached files. The generator's log file is included.

Returns

array<mixed,\FeaturePhp\File\File>

Returns a map from all generator keys to class names.

getGeneratorMap() : array<mixed,string>
InheritedStatic

Returns

array<mixed,string>

Returns the runtime generator's key.

getKey() : string
Static

The key is the name used to identify the \FeaturePhp\Generator\Settings for a generator.

inherited_from \FeaturePhp\Generator\Generator::getKey()

Returns

string

Returns the generator's key.

getKey() : string
InheritedStatic

The key is the name used to identify the \FeaturePhp\Generator\Settings for a generator.

Returns

string

Returns all registered artifacts (selected and deselected).

getRegisteredArtifacts() : array<mixed,\FeaturePhp\Artifact\Artifact>
Inherited

Returns

array<mixed,\FeaturePhp\Artifact\Artifact>

Returns the generator's settings.

getSettings() : \FeaturePhp\Generator\Settings
Inherited

Returns

\FeaturePhp\Generator\Settings

Returns whether any artifacts are registered with the generator.

hasArtifacts() : boolean
Inherited

Returns

boolean

Returns tracing links for all registered artifacts.

trace() : array<mixed,\FeaturePhp\Artifact\TracingLink>
Inherited

Returns

array<mixed,\FeaturePhp\Artifact\TracingLink>

Returns tracing links for all calls of the runtime class.

traceRuntimeCalls(array<mixed,\FeaturePhp\File\File> $files, \FeaturePhp\ProductLine\ProductLine $productLine) : array<mixed,\FeaturePhp\Artifact\TracingLink>

Parameters

$files

array<mixed,\FeaturePhp\File\File>

$productLine

\FeaturePhp\ProductLine\ProductLine

Returns

array<mixed,\FeaturePhp\Artifact\TracingLink>

Generates the runtime file.

_generateFiles() 

Internally, this uses a template file and assigns the given variables. You can override this to add runtime information for other languages. If a feature was supplied, only generates if that feature is selected.

inherited_from \FeaturePhp\Generator\Generator::_generateFiles()

Internal function for generating the files for all registered artifacts.

_generateFiles() 
Inherited

Returns whether a feature's artifact is selected.

isSelectedFeature(string $featureName) : boolean
Inherited

Parameters

$featureName

string

Returns

boolean

Returns the JSON-encoded names of the corresponding features of some artifacts.

encodeFeatureNames(array<mixed,\FeaturePhp\Artifact\Artifact> $artifacts) : string

The JSON is assumed to then be enclosed in single quotes (').

Parameters

$artifacts

array<mixed,\FeaturePhp\Artifact\Artifact>

Returns

string

Returns the class names of all generators.

getGenerators() : array<mixed,string>
InheritedStatic

Returns

array<mixed,string>

 Properties

 

artifacts with a corresponding deselected feature that specify this generator

$deselectedArtifacts : array<mixed,\FeaturePhp\Artifact\Artifact>

Default

 

cached files generated by this generator

$files : array<mixed,\FeaturePhp\File\File>

Default

 

the log file for this generator

$logFile : \FeaturePhp\File\LogFile

Default

 

artifacts with a corresponding selected feature that specify this generator

$selectedArtifacts : array<mixed,\FeaturePhp\Artifact\Artifact>

Default

 

the settings object with generator settings

$settings : \FeaturePhp\Generator\Settings

Default

   

the runtime class name, defaults to "Runtime"

$class : string

Default

 

a feature that has to be selected to generate the runtime class

$feature : string | null

Default

 

the runtime class method for getting feature information, default to "hasFeature"

$getter : string

Default

 

the runtime class file target in the generated product, defaults to "Runtime.php"

$target : string

Default