AddDuplicationCheckTask::getCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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 -t 1 src';
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