MakeRepositoryPatternCommand::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Pratiksh\Adminetic\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Pratiksh\Adminetic\Services\RepositoryPatternService;
7
8
class MakeRepositoryPatternCommand extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'make:repo {name : Model Class (Singular), e.g User, Place, Car, Post} {--r|request : Make Repo Pattern with request}';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Create Repository Pattern with a single command';
23
24
    /**
25
     * Create a new command instance.
26
     *
27
     * @return void
28
     */
29
    public function __construct()
30
    {
31
        parent::__construct();
32
    }
33
34
    /**
35
     * Execute the console command.
36
     *
37
     * @return mixed
38
     */
39
    public function handle()
40
    {
41
        $name = $this->argument('name');
42
43
        $makeRequest = $this->option('request');
44
45
        RepositoryPatternService::ImplementNow($name, $makeRequest);
46
47
        $this->info('Repository pattern implemented for model '.$name);
0 ignored issues
show
Bug introduced by
Are you sure $name of type array|null|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

47
        $this->info('Repository pattern implemented for model './** @scrutinizer ignore-type */ $name);
Loading history...
48
    }
49
}
50