Convert ProjectTemplates constants to enum cases
This commit is contained in:
parent
e98b949b7d
commit
2a16b2de6b
3 changed files with 7 additions and 15 deletions
|
@ -292,9 +292,9 @@
|
|||
}
|
||||
|
||||
Console::out(PHP_EOL . 'Available Templates:');
|
||||
foreach(ProjectTemplates::ALL as $template)
|
||||
foreach(ProjectTemplates::cases() as $template)
|
||||
{
|
||||
Console::out(' ' . $template);
|
||||
Console::out(' ' . $template->value);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -22,23 +22,15 @@
|
|||
|
||||
namespace ncc\Enums;
|
||||
|
||||
final class ProjectTemplates
|
||||
enum ProjectTemplates : string
|
||||
{
|
||||
/**
|
||||
* A template that is used to create a PHP library project
|
||||
*/
|
||||
public const PHP_LIBRARY = 'phplib';
|
||||
case PHP_LIBRARY = 'phplib';
|
||||
|
||||
/**
|
||||
* A template that is used to create a PHP CLI application project
|
||||
*/
|
||||
public const PHP_CLI = 'phpcli';
|
||||
|
||||
/**
|
||||
* An array of all the available project templates
|
||||
*/
|
||||
public const ALL = [
|
||||
self::PHP_LIBRARY,
|
||||
self::PHP_CLI
|
||||
];
|
||||
case PHP_CLI = 'phpcli';
|
||||
}
|
|
@ -185,11 +185,11 @@
|
|||
{
|
||||
switch(strtolower($template_name))
|
||||
{
|
||||
case ProjectTemplates::PHP_CLI:
|
||||
case ProjectTemplates::PHP_CLI->value:
|
||||
CliTemplate::applyTemplate($this);
|
||||
break;
|
||||
|
||||
case ProjectTemplates::PHP_LIBRARY:
|
||||
case ProjectTemplates::PHP_LIBRARY->value:
|
||||
LibraryTemplate::applyTemplate($this);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue