GenerateGatewayRepositoryType.php 1.19 KB
Newer Older
1
2
3
4
5
<?php


namespace App\Console\Commands\GatewayCommands;

Jacob Priddy's avatar
Jacob Priddy committed
6
7
class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator
{
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
33
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'gateway:create-repository-type {name} {type}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Generate a specific gateway repository class in the source directory';

    /**
     * The type of class being generated.
     *
     * @var string
     */
    protected $type = 'Specific Gateway Repository';

    /**
     * Get the stub file for the generator.
     *
     * @return string
     */
Jacob Priddy's avatar
Jacob Priddy committed
34
35
    protected function getStub()
    {
36
37
38
39
40
41
42
43
44
45
        $type = $this->argument('type');
        return __DIR__ . '/stubs/' . ucfirst($type) . '.stub';
    }

    /**
     * Get the destination class path.
     *
     * @param string $name
     * @return string
     */
Jacob Priddy's avatar
Jacob Priddy committed
46
47
    protected function getPath($name)
    {
48
49
50
51
52
        $name = $this->getNameInput();
        $type = $this->argument('type');
        return $this->laravel->basePath() . '/src/Gateways/' . $name . '/' . $type . $name . 'Repository.php';
    }
}