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

ComposerUpdateExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A requireDefaultRecords() 0 6 1
A getJobName() 0 4 1
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