Completed
Push — master ( 55accb...6b95b9 )
by
unknown
17:55
created

src/Jobs/CheckComposerUpdatesJob.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Composer update checker job. Runs the check as a queuedjob.
4
 *
5
 * @author Peter Thaleikis
6
 * @license MIT
7
 */
8
class CheckComposerUpdatesJob extends AbstractQueuedJob implements QueuedJob
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
9
{
10
    /**
11
     * The task to run
12
     *
13
     * @var BuildTask
14
     */
15
    protected $task;
16
17
    /**
18
     * define the title
19
     *
20
     * @return string
21
     */
22
    public function getTitle()
23
    {
24
        return _t(
25
            'ComposerUpdateChecker.Title',
26
            'Check if composer updates are available'
27
        );
28
    }
29
30
    /**
31
     * define the type.
32
     */
33
    public function getJobType()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
34
    {
35
        $this->totalSteps = 1;
36
37
        return QueuedJob::QUEUED;
38
    }
39
40
    /**
41
     * init
42
     */
43
    public function setup()
44
    {
45
        // create the instance of the task
46
        $this->task = Injector::inst()->create(CheckComposerUpdatesTask::class);
47
    }
48
49
    /**
50
     * processes the task as a job
51
     */
52
    public function process()
53
    {
54
        // run the task
55
        $this->task->run(new SS_HTTPRequest('GET', '/'));
56
57
        // mark job as completed
58
        $this->isComplete = true;
59
    }
60
}
61