Files
Woles-Framework/app/Core/Commands/CommandFactory.php

41 lines
1.1 KiB
PHP
Raw Permalink Normal View History

<?php
namespace App\Core\Commands;
/**
* Woles Command Factory
* Factory for creating command instances
*/
class CommandFactory
{
/**
* Create command instance
*/
public static function create(string $command): object
{
switch ($command) {
case 'make:module':
return new MakeModuleCommand();
case 'make:controller':
return new MakeControllerCommand();
case 'make:model':
return new MakeModelCommand();
case 'serve':
return new ServeCommand();
case 'migrate':
return new MigrateCommand();
case 'migrate:rollback':
return new MigrateCommand();
case 'migrate:status':
return new MigrateCommand();
case 'seed':
return new SeedCommand();
case 'key:generate':
return new KeyGenerateCommand();
case 'help':
default:
return new HelpCommand();
}
}
}