Completed
Push — master ( f601f1...3631c8 )
by Nekrasov
04:15
created

MakeAnonymizerCommand::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Arrilot\LaravelDataAnonymization\Commands;
4
5
use Illuminate\Support\Composer;
6
use Illuminate\Filesystem\Filesystem;
7
use Illuminate\Console\GeneratorCommand;
8
9
class MakeAnonymizerCommand extends GeneratorCommand
10
{
11
    /**
12
     * The console command name.
13
     *
14
     * @var string
15
     */
16
    protected $name = 'make:anonymizer';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Create a new anonymizer class';
24
25
    /**
26
     * The type of class being generated.
27
     *
28
     * @var string
29
     */
30
    protected $type = 'Anonymizer';
31
32
    /**
33
     * The Composer instance.
34
     *
35
     * @var \Illuminate\Support\Composer
36
     */
37
    protected $composer;
38
39
    /**
40
     * Create a new command instance.
41
     *
42
     * @param  \Illuminate\Filesystem\Filesystem  $files
43
     * @param  \Illuminate\Support\Composer  $composer
44
     */
45
    public function __construct(Filesystem $files, Composer $composer)
46
    {
47
        parent::__construct($files);
48
49
        $this->composer = $composer;
50
    }
51
    
52
    public function handle()
53
    {
54
    	return $this->fire();
55
    }
56
57
    /**
58
     * Execute the console command.
59
     *
60
     * @return void
61
     */
62
    public function fire()
63
    {
64
        parent::fire();
65
66
        $this->composer->dumpAutoloads();
67
    }
68
69
    /**
70
     * Get the stub file for the generator.
71
     *
72
     * @return string
73
     */
74
    protected function getStub()
75
    {
76
        return __DIR__.'/stubs/anonymizer.stub';
77
    }
78
79
    /**
80
     * Get the destination class path.
81
     *
82
     * @param  string  $name
83
     * @return string
84
     */
85
    protected function getPath($name)
86
    {
87
        return $this->laravel->databasePath().'/anonymization/'.$name.'.php';
0 ignored issues
show
Bug introduced by
The method databasePath() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean basePath()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
88
    }
89
90
    /**
91
     * Parse the name and format according to the root namespace.
92
     *
93
     * @param  string  $name
94
     * @return string
95
     */
96
    protected function parseName($name)
97
    {
98
        return $name;
99
    }
100
}
101