Passed
Push — master ( 59950a...c6d7cc )
by Ron
02:46 queued 13s
created

TbBackupCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
c 1
b 0
f 0
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 12 3
A __construct() 0 3 1
1
<?php
2
3
namespace App\Console\Commands;
4
5
use Illuminate\Console\Command;
6
7
use App\Jobs\ApplicationBackupJob;
8
9
class TbBackupCommand extends Command
10
{
11
    protected $signature   = 'tb_backup:run
12
                                {--databaseOnly : Only backup the configuration database}
13
                                {--filesOnly    : Only backup the file system}';
14
    protected $description = 'Creates a backup of the Tech Bench application';
15
16
    /**
17
     * Create a new command instance
18
     */
19
    public function __construct()
20
    {
21
        parent::__construct();
22
    }
23
24
    /**
25
     * Manually run a system backup
26
     */
27
    public function handle()
28
    {
29
        $this->line('Starting application backup');
30
        $this->line('Please wait...');
31
32
        $files    = $this->option('databaseOnly') ? false : true;
33
        $database = $this->option('filesOnly') ? false : true;
34
35
        ApplicationBackupJob::dispatch($database, $files)->onConnection('sync');
36
37
        $this->line('Backup Completed');
38
        return 0;
39
    }
40
}
41