Completed
Pull Request — master (#27)
by Robbie
03:01
created

ComposerUpdateExtension::requireDefaultRecords()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace BringYourOwnIdeas\UpdateChecker\Extensions;
4
5
use CheckComposerUpdatesJob;
6
use DataExtension;
7
use Injector;
8
use QueuedJobService;
9
10
/**
11
 * Describes any available updates to an installed Composer package
12
 *
13
 * Originally from https://github.com/XploreNet/silverstripe-composerupdates
14
 */
15
class ComposerUpdateExtension extends DataExtension
16
{
17
    /**
18
     * @var string
19
     */
20
    protected $jobName = 'CheckComposerUpdatesJob';
21
22
    private static $db = [
0 ignored issues
show
Unused Code introduced by
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
23
        'VersionHash' => 'Varchar',
24
        'LatestVersion' => 'Varchar',
25
    ];
26
27
    private static $summary_fields = [
0 ignored issues
show
Unused Code introduced by
The property $summary_fields is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
28
        'LatestVersion',
29
    ];
30
31
    /**
32
     * Automatically schedule a self update job on dev/build
33
     */
34
    public function requireDefaultRecords()
35
    {
36
        Injector::inst()
37
            ->get(QueuedJobService::class)
38
            ->queueJob(new CheckComposerUpdatesJob());
39
    }
40
41
    /**
42
     * Return the name of the related job
43
     *
44
     * @return string
45
     */
46
    public function getJobName()
47
    {
48
        return $this->jobName;
49
    }
50
}
51