Completed
Pull Request — master (#51)
by Garion
07:01
created

SecurityAlertCheckJob::setCheckTask()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace BringYourOwnIdeas\SecurityChecker\Jobs;
4
5
use BringYourOwnIdeas\SecurityChecker\Tasks\SecurityAlertCheckTask;
6
use SilverStripe\Core\Injector\Injector;
7
use Symbiote\QueuedJobs\Services\QueuedJob;
8
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
9
10
/**
11
 * Composer security checker job. Runs the task which does the check as a queuedjob.
12
 *
13
 * @author Peter Thaleikis
14
 * @license BSD-3-Clause
15
 */
16
class SecurityAlertCheckJob extends AbstractQueuedJob implements QueuedJob
17
{
18
    public function getTitle()
19
    {
20
        return _t(
21
            __CLASS__ . '.Title',
22
            'Check if any composer managed modules have known security vulnerabilities.'
23
        );
24
    }
25
26
    public function getJobType()
27
    {
28
        $this->totalSteps = 1;
29
30
        return QueuedJob::QUEUED;
31
    }
32
33
    public function process()
34
    {
35
        // run the task
36
        $task = Injector::inst()->create(SecurityAlertCheckTask::class);
37
        $task->run(null);
38
39
        // mark job as completed
40
        $this->isComplete = true;
41
    }
42
}
43