DatabaseBackupCommand::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 11
rs 10
1
<?php
2
3
namespace Ikechukwukalu\Databasebackup\Console\Commands;
4
5
use Illuminate\Console\Command;
6
7
class DatabaseBackupCommand extends Command
8
{
9
    /**
10
     * The name and signature of the console command.
11
     *
12
     * @var string
13
     */
14
    protected $signature = 'database:backup';
15
16
    /**
17
     * The console command description.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Backup database';
22
23
    /**
24
     * Execute the console command.
25
     *
26
     * @return int
27
     */
28
    public function handle()
29
    {
30
        $command = config('databasebackup.remote_access') ?
31
        config('databasebackup.remote_backup_command') :
32
        config('databasebackup.local_backup_command');
33
34
        $returnVar = NULL;
35
        $output  = NULL;
36
37
        exec($command, $output, $returnVar);
38
        $this->info('Database backup was successful.');
39
    }
40
}
41