/** * */ public function fire() { $classPath = str_replace('\\', '/', $this->argument('path')); $properties = $this->option('properties'); $base = $this->option('base'); $commandStub = __DIR__ . '/stubs/command.stub'; $handlerStub = __DIR__ . '/stubs/handler.stub'; // We'll generate Command and CommandHandler classes. $this->generator->make($classPath, $commandStub, $base, $properties); $this->generator->make($classPath . 'Handler', $handlerStub, $base, $properties); $this->info('All done! Your two classes have now been generated.'); }
{ /** * @var string */ public $name; /** * @var string */ public $type; /** * @param string $name * @param string $type */ public function __construct($name, $type) { $this->name = $name; $this->type = $type; } /** * Do any logic required to provide file handling * * @return string */ public function generateFile() { return $this->name; } } $content = new Content('background', 'jpeg'); $generator = new FileGenerator($content); var_dump($generator->create());