DatabaseBackupCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 2
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