Completed
Push — master ( d32259...77ced4 )
by Gordon
08:40 queued 06:34
created

AddDuplicationCheckTask   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 11
c 0
b 0
f 0
dl 0
loc 53
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A isCodeCheck() 0 3 1
A filesToCopy() 0 3 1
A getComposerScripts() 0 3 1
A getCommand() 0 3 1
A getTravisBeforeScript() 0 5 1
A getComposerPackages() 0 3 1
A getTravisScript() 0 3 1
A getFlag() 0 3 1
1
<?php declare(strict_types = 1);
2
3
namespace Suilven\PHPTravisEnhancer\Task;
4
5
use Suilven\PHPTravisEnhancer\Abstraction\TaskBase;
6
use Suilven\PHPTravisEnhancer\IFace\Task;
7
8
class AddDuplicationCheckTask extends TaskBase implements Task
9
{
10
    /** @return string bash variable for use in Travis script */
11
    public function getFlag(): string
12
    {
13
        return 'DUPLICATE_CODE_CHECK';
14
    }
15
16
17
    public function getCommand(): string
18
    {
19
        return 'duplication';
20
    }
21
22
23
    public function getTravisBeforeScript(): ?string
24
    {
25
        return 'sudo apt remove -y nodejs && curl '
26
            . '-sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh && sudo bash nodesource_setup.sh '
27
            . '&& sudo apt install -y build-essential nodejs && which npm && npm install [email protected]';
28
    }
29
30
31
    public function getTravisScript(): ?string
32
    {
33
        return 'node_modules/jscpd/bin/jscpd src && node_modules/jscpd/bin/jscpd tests';
34
    }
35
36
37
    /** @return array<string,string> this command is only run within Travis, as it requires node installed */
38
    public function getComposerScripts(): array
39
    {
40
        return [];
41
    }
42
43
44
    /** @return array<string> */
45
    public function getComposerPackages(): array
46
    {
47
        return [];
48
    }
49
50
51
    /** @return array<string, string> */
52
    public function filesToCopy(): array
53
    {
54
        return [];
55
    }
56
57
58
    public function isCodeCheck(): bool
59
    {
60
        return false;
61
    }
62
}
63