ExportCommand::handle()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
nc 4
nop 0
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Djunehor\Env;
4
5
6
use Illuminate\Console\Command;
7
8
class ExportCommand extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'env:export
16
                           {--f|from=.env}
17
                            {--t|to=.env.example}';
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Export env keys to a file';
24
25
26
    /**
27
     * Execute the console command.
28
     *
29
     * @return void
30
     */
31 4
    public function handle()
32
    {
33 4
        $from = $this->hasOption('from') ? $this->option('from') : '.env';
34 4
        $to = $this->hasOption('to') ? $this->option('to') : '.env.example';
35 4
        export_env($from, $to);
36 3
        $this->info("Keys successfully exported from [$from] to [$to]");
37 3
    }
38
}
39
40