1 | <?php |
||||||
2 | |||||||
3 | namespace Maestriam\Samurai\Console; |
||||||
4 | |||||||
5 | use Exception; |
||||||
6 | use Maestriam\Samurai\Support\Samurai; |
||||||
7 | |||||||
8 | class MakeComponentCommand extends BaseCommand |
||||||
9 | { |
||||||
10 | /** |
||||||
11 | * {@inheritDoc} |
||||||
12 | */ |
||||||
13 | protected $signature = 'samurai:make-component {name} {theme?}'; |
||||||
14 | |||||||
15 | /** |
||||||
16 | * {@inheritDoc} |
||||||
17 | */ |
||||||
18 | protected $description = 'Create a new component for specific theme'; |
||||||
19 | |||||||
20 | /** |
||||||
21 | * {@inheritDoc} |
||||||
22 | */ |
||||||
23 | protected string $successMessage = 'Component [%s] created into [%s]: %s'; |
||||||
24 | |||||||
25 | /** |
||||||
26 | * {@inheritDoc} |
||||||
27 | */ |
||||||
28 | protected string $errorMessage = 'Error to create component: %s'; |
||||||
29 | |||||||
30 | /** |
||||||
31 | * Executa o comando de criação de componente atráves do Artisan |
||||||
32 | * |
||||||
33 | * @return void |
||||||
34 | */ |
||||||
35 | public function handle() |
||||||
36 | { |
||||||
37 | try { |
||||||
38 | |||||||
39 | $name = $this->getDirectiveArgument(); |
||||||
40 | |||||||
41 | $theme = $this->getThemeArgument(); |
||||||
42 | |||||||
43 | $component = Samurai::theme($theme)->component($name)->create(); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
44 | |||||||
45 | Samurai::base()->clean(); |
||||||
0 ignored issues
–
show
The method
base() does not exist on Maestriam\Samurai\Support\Samurai . Since you implemented __callStatic , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
46 | |||||||
47 | return $this->success($name, $theme, $component->relative()); |
||||||
0 ignored issues
–
show
|
|||||||
48 | |||||||
49 | } catch (Exception $e) { |
||||||
50 | return $this->failure($e); |
||||||
0 ignored issues
–
show
|
|||||||
51 | } |
||||||
52 | } |
||||||
53 | } |
||||||
54 |