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
显示文件 Open project: rainlab/builder-plugin Class Usage Examples

Protected Properties

Property Type Description
$destinationPath
$structure
$templatesPath
$variables

Public Methods

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

Protected Methods

Method Description
makeDirectory ( $dirPath )
makeFile ( $filePath, $templateName )

Method Details

__construct() public method

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 method

public generate ( )

makeDirectory() protected method

protected makeDirectory ( $dirPath )

makeFile() protected method

protected makeFile ( $filePath, $templateName )

setVariable() public method

public setVariable ( $key, $value )

setVariables() public method

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