SecurityAlertCheckJob   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 52
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setCheckTask() 0 4 1
A getCheckTask() 0 3 1
A process() 0 8 1
A getTitle() 0 5 1
A getJobType() 0 5 1
1
<?php
2
3
namespace BringYourOwnIdeas\SecurityChecker\Jobs;
4
5
use BringYourOwnIdeas\SecurityChecker\Tasks\SecurityAlertCheckTask;
6
use Symbiote\QueuedJobs\Services\QueuedJob;
7
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
8
9
/**
10
 * Composer security checker job. Runs the task which does the check as a queuedjob.
11
 *
12
 * @author Peter Thaleikis
13
 * @license BSD-3-Clause
14
 */
15
class SecurityAlertCheckJob extends AbstractQueuedJob implements QueuedJob
16
{
17
    private static $dependencies = [
0 ignored issues
show
introduced by
The private property $dependencies is not used, and could be removed.
Loading history...
18
        'checkTask' => '%$' . SecurityAlertCheckTask::class,
19
    ];
20
21
    /**
22
     * @var SecurityAlertCheckTask
23
     */
24
    protected $checkTask;
25
26
    /**
27
     * @return SecurityAlertCheckTask
28
     */
29
    public function getCheckTask()
30
    {
31
        return $this->checkTask;
32
    }
33
34
    /**
35
     * @param SecurityAlertCheckTask $checkTask
36
     * @return SecurityAlertCheckJob
37
     */
38
    public function setCheckTask(SecurityAlertCheckTask $checkTask)
39
    {
40
        $this->checkTask = $checkTask;
41
        return $this;
42
    }
43
44
    public function getTitle()
45
    {
46
        return _t(
47
            __CLASS__ . '.Title',
48
            'Check if any composer managed modules have known security vulnerabilities.'
49
        );
50
    }
51
52
    public function getJobType()
53
    {
54
        $this->totalSteps = 1;
55
56
        return QueuedJob::QUEUED;
57
    }
58
59
    public function process()
60
    {
61
        // run the task
62
        $task = $this->getCheckTask();
63
        $task->run(null);
64
65
        // mark job as completed
66
        $this->isComplete = true;
67
    }
68
}
69