MixinGenerator
extends AbstractThemeUtility
in package
implements
GeneratorInterface
Uses
ConsoleOutputTrait
Class to generate a new mixin from a template.
Tags
Interfaces, Classes, Traits and Enums
- GeneratorInterface
- Interface shared by theme and mixin generator classes.
Table of Contents
- $info : ThemeInfo
- Theme info object
- $lastError : string
- Last error message
- $outputInterface : OutputInterface
- Output interface.
- __construct() : mixed
- Constructor
- generate() : bool
- Generate a new mixin from a template.
- getLastError() : string
- Get last error message.
- setOutputInterface() : mixed
- Set the output interface. Implements a fluent interface.
- writeln() : mixed
- Write a line to the output (if available). Implements a fluent interface.
- copyDir() : bool
- Copy the contents of $src into $dest if no matching files already exist.
- deleteDir() : bool
- Recursively delete a directory and its contents.
- setLastError() : bool
- Set last error message and return a boolean false.
Properties
$info
Theme info object
protected
ThemeInfo
$info
$lastError
Last error message
protected
string
$lastError
= null
$outputInterface
Output interface.
protected
OutputInterface
$outputInterface
= null
Methods
__construct()
Constructor
public
__construct(ThemeInfo $info) : mixed
Parameters
- $info : ThemeInfo
-
Theme info object
Return values
mixed —generate()
Generate a new mixin from a template.
public
generate(string $name[, string $template = 'local_mixin_example' ]) : bool
Parameters
- $name : string
-
Name of mixin to generate.
- $template : string = 'local_mixin_example'
-
Name of template mixin directory
Return values
bool —getLastError()
Get last error message.
public
getLastError() : string
Return values
string —setOutputInterface()
Set the output interface. Implements a fluent interface.
public
setOutputInterface(OutputInterface $output) : mixed
Parameters
- $output : OutputInterface
-
Output interface
Return values
mixed —writeln()
Write a line to the output (if available). Implements a fluent interface.
public
writeln(string $output) : mixed
Parameters
- $output : string
-
Line to output.
Return values
mixed —copyDir()
Copy the contents of $src into $dest if no matching files already exist.
protected
copyDir(string $src, string $dest) : bool
Parameters
- $src : string
-
Source directory
- $dest : string
-
Target directory
Return values
bool —deleteDir()
Recursively delete a directory and its contents.
protected
deleteDir(string $path) : bool
Parameters
- $path : string
-
Directory to delete.
Return values
bool —setLastError()
Set last error message and return a boolean false.
protected
setLastError(string $error) : bool
Parameters
- $error : string
-
Error message.