vd/vendor/dipper/console/src/Commands/ControllerMakeCommand.php
2018-11-05 09:26:30 +08:00

70 lines
1.4 KiB
PHP

<?php
namespace Dipper\Console\Commands;
use Symfony\Component\Console\Input\InputOption;
/**
* @author HollyTeng <n.haoyuan@gmail.com>
*/
class ControllerMakeCommand extends GeneratorCommand
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'make:controller';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new resource Controller class in a domain';
/**
* The type of class being generated.
*
* @var string
*/
protected $type = 'Controller';
/**
* Get the stub file for the generator.
*
* @return string
*/
protected function getStub()
{
if ($this->option('plain')) {
return __DIR__ . '/stubs/controller.plain.stub';
}
return __DIR__ . '/stubs/controller.stub';
}
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\\Http\\'.str_plural($this->type);
}
/**
* Get the console command options.
*
* @return array
*/
public function getOptions()
{
return [
['plain', null, InputOption::VALUE_NONE, 'Generate an empty controller class.'],
];
}
}