AspectCommand.php 862 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace Hyperf\Devtool\Generator;
  12. use Hyperf\Command\Annotation\Command;
  13. #[Command]
  14. class AspectCommand extends GeneratorCommand
  15. {
  16. public function __construct()
  17. {
  18. parent::__construct('gen:aspect');
  19. }
  20. public function configure()
  21. {
  22. $this->setDescription('Create a new aspect class');
  23. parent::configure();
  24. }
  25. protected function getStub(): string
  26. {
  27. return $this->getConfig()['stub'] ?? __DIR__ . '/stubs/aspect.stub';
  28. }
  29. protected function getDefaultNamespace(): string
  30. {
  31. return $this->getConfig()['namespace'] ?? 'App\\Aspect';
  32. }
  33. }