Passed
Push — master ( b68c65...48f954 )
by Nicolaas
02:05
created

ComposerInstallSimple::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Sunnysideup\UpgradeToSilverstripe4\Tasks\IndividualTasks;
4
5
use Sunnysideup\UpgradeToSilverstripe4\Api\FileSystemFixes;
6
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Helpers\Composer;
7
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Helpers\ComposerJsonFixes;
8
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Helpers\Git;
9
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Task;
10
11
/**
12
 * Install a basic / standard install of Silverstripe ('.$this->versionToLoad.')
13
 * using composer' ;
14
 */
15
class ComposerInstallSimple extends Task
16
{
17
    protected $taskStep = 's20';
18
19
    protected $versionToLoad = '';
20
21
22
    /**
23
     * @var string
24
     */
25
    protected $composerOptions = '--prefer-dist';
26
27
    public function getTitle()
28
    {
29
        return 'use Composer to install requirements.';
30
    }
31
32
    public function getDescription()
33
    {
34
        return '';
35
    }
36
37
    public function runActualTask($params = []): ?string
38
    {
39
        $this->mu()->setBreakOnAllErrors(true);
0 ignored issues
show
Bug introduced by
It seems like setBreakOnAllErrors() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
        $this->mu()->/** @scrutinizer ignore-call */ setBreakOnAllErrors(true);
Loading history...
40
        $command = '
41
        composer install ;'.$this->composerOptions;
42
        $this->mu()->execMe(
0 ignored issues
show
Bug introduced by
It seems like execMe() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
        $this->mu()->/** @scrutinizer ignore-call */ execMe(
Loading history...
43
            $this->mu()->getGitRootDir(),
0 ignored issues
show
Bug introduced by
It seems like getGitRootDir() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
            $this->mu()->/** @scrutinizer ignore-call */ getGitRootDir(),
Loading history...
44
            $command,
45
            'Basic composer install',
46
            false
47
        );
48
49
        $this->mu()->setBreakOnAllErrors(false);
50
        return null;
51
    }
52
53
54
    protected function hasCommitAndPush()
55
    {
56
        return false;
57
    }
58
}
59