PHP Class RainLab\Builder\Classes\FilesystemGenerator

Example - generate a plugin directory containing the plugin.php file. The file is created from a template, which uses a couple of variables. $structure = [ 'author', 'author/plugin', 'author/plugin/plugin.php' => 'plugin.php.tpl' ]; $generator = new FilesystemGenerator('$', $structure, '$/Author/Plugin/templates/plugin'); $variables = [ 'namespace' => 'Author/Plugin' ]; $generator->setVariables($variables); $generator->generate();
Author: Alexey Bobkov, Samuel Georges
Afficher le fichier Open project: rainlab/builder-plugin Class Usage Examples

Protected Properties

Свойство Type Description
$destinationPath
$structure
$templatesPath
$variables

Méthodes publiques

Méthode Description
__construct ( string $destinationPath, array $structure, string $templatesPath = null ) Initializes the object.
generate ( )
setVariable ( $key, $value )
setVariables ( $variables )

Méthodes protégées

Méthode Description
makeDirectory ( $dirPath )
makeFile ( $filePath, $templateName )

Method Details

__construct() public méthode

Initializes the object.
public __construct ( string $destinationPath, array $structure, string $templatesPath = null )
$destinationPath string Destination path to create the filesystem objects in. The path can contain filesystem symbols.
$structure array Specifies the structure as array.
$templatesPath string Path to the directory that contains file templates. The parameter is required only in case any files should be created. The path can contain filesystem symbols.

generate() public méthode

public generate ( )

makeDirectory() protected méthode

protected makeDirectory ( $dirPath )

makeFile() protected méthode

protected makeFile ( $filePath, $templateName )

setVariable() public méthode

public setVariable ( $key, $value )

setVariables() public méthode

public setVariables ( $variables )

Property Details

$destinationPath protected_oe property

protected $destinationPath

$structure protected_oe property

protected $structure

$templatesPath protected_oe property

protected $templatesPath

$variables protected_oe property

protected $variables