GenerateUseCasePresenter.php 1.05 KB
Newer Older
Jacob Priddy's avatar
Jacob Priddy committed
1
2
3
4
<?php

namespace App\Console\Commands\UseCaseCommands;

Jacob Priddy's avatar
Jacob Priddy committed
5
6
class GenerateUseCasePresenter extends BaseUseCaseFileGenerator
{
Jacob Priddy's avatar
Jacob Priddy committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'use-case:create-use-case-presenter {name}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Generate a use case presenter class in the source directory';

    /**
     * The type of class being generated.
     *
     * @var string
     */
    protected $type = 'Use Case Presenter';

    /**
     * Get the stub file for the generator.
     *
     * @return string
     */
Jacob Priddy's avatar
Jacob Priddy committed
33
34
    protected function getStub()
    {
Jacob Priddy's avatar
Jacob Priddy committed
35
36
37
38
39
40
        return __DIR__ . '/stubs/presenter.stub';
    }

    /**
     * Get the destination class path.
     *
41
     * @param string $name
Jacob Priddy's avatar
Jacob Priddy committed
42
43
     * @return string
     */
Jacob Priddy's avatar
Jacob Priddy committed
44
45
    protected function getPath($name)
    {
Jacob Priddy's avatar
Jacob Priddy committed
46
        $name = $this->getNameInput();
47
        return $this->laravel->basePath() . '/src/UseCases/' . $name . '/Presenter.php';
Jacob Priddy's avatar
Jacob Priddy committed
48
49
    }
}