Completed
Branch add-test-cases (10aafb)
by Basenko
05:32
created

MakeCronTask   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 1
1
<?php
2
3
namespace MadWeb\Initializer\Jobs;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Foundation\Bus\Dispatchable;
7
8
class MakeCronTask
9
{
10
    use Dispatchable, Queueable;
11
12
    /**
13
     * Execute the job.
14
     *
15
     * @return string
16
     */
17 3
    public function handle()
18
    {
19 3
        $base_path = base_path();
20 3
        $task = '* * * * * php '.$base_path.'/artisan schedule:run >> /dev/null 2>&1';
21 3
        exec('(crontab -l 2>/dev/null; echo "'.$task.'") | crontab -');
22
23 3
        return 'Base cron task for scheduling work created. Task: '.$task;
24
    }
25
}
26