Passed
Push — master ( 3cb518...ba9ea6 )
by Thomas
40s
created

MakeEntity::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Webfactor\Laravel\Generators\Commands;
4
5
use Illuminate\Console\Command;
6
use Symfony\Component\Finder\SplFileInfo;
7
use Webfactor\Laravel\Generators\MakeServices;
8
use Webfactor\Laravel\Generators\Schemas\MigrationSchema;
9
10
class MakeEntity extends Command
11
{
12
    /**
13
     * Paths to files which should automatically be opened in IDE if the
14
     * option --ide is set (and IDE capable).
15
     *
16
     * @var array
17
     */
18
    public $filesToBeOpened = [];
19
20
    /**
21
     * The name of the entity being created.
22
     *
23
     * @var string
24
     */
25
    public $entity;
26
27
    /**
28
     * The migration schema object.
29
     *
30
     * @var MigrationSchema
31
     */
32
    public $schema;
33
34
    /**
35
     * The name and signature of the console command.
36
     *
37
     * @var string
38
     */
39
    protected $signature = 'make:entity {entity} {--schema="name:string"} {--migrate} {--ide=}';
40
41
    /**
42
     * The console command description.
43
     *
44
     * @var string
45
     */
46
    protected $description = 'Make Entity';
47
48
    /**
49
     * Execute the console command.
50
     *
51
     * @return mixed
52
     */
53
    public function handle()
54
    {
55
        $this->entity = $this->argument('entity');
56
        $this->schema = new MigrationSchema($this->option('schema'));
57
58
        (new MakeServices($this))->call();
59
    }
60
61
    /**
62
     * Adds file to $filesToBeOpened stack.
63
     *
64
     * @param $file
65
     * @return void
66
     */
67
    public function addFile(SplFileInfo $file): void
68
    {
69
        array_push($this->filesToBeOpened, $file);
70
    }
71
}
72