MakeStrategy.php 1003 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Knuckles\Scribe\Commands;
  3. use Illuminate\Console\GeneratorCommand;
  4. class MakeStrategy extends GeneratorCommand
  5. {
  6. protected $signature = 'scribe:strategy
  7. {name : Name of the class.}
  8. {stage : The stage the strategy belongs to. One of "metadata", "urlParameters", "queryParameters", "bodyParameters", "headers", "responses", "responseFields".}
  9. {--force : Overwrite file if it exists}
  10. ';
  11. protected $description = 'Create a new strategy class.';
  12. protected $type = 'Strategy';
  13. protected function getStub()
  14. {
  15. return __DIR__ . '/stubs/strategy.stub';
  16. }
  17. protected function getDefaultNamespace($rootNamespace)
  18. {
  19. return $rootNamespace.'\Docs\Strategies';
  20. }
  21. protected function replaceClass($stub, $name)
  22. {
  23. $stub = parent::replaceClass($stub, $name);
  24. return str_replace('dummyStage', $this->argument('stage'), $stub);
  25. }
  26. }