ComposerInstallSimple::runActualTask()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 13
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Sunnysideup\UpgradeToSilverstripe4\Tasks\IndividualTasks;
4
5
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Helpers\Composer;
6
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Task;
7
8
/**
9
 * Install a basic / standard install of Silverstripe ('.$this->versionToLoad.')
10
 * using composer' ;
11
 */
12
class ComposerInstallSimple extends Task
13
{
14
    protected $taskStep = 's20';
15
16
    protected $versionToLoad = '';
17
18
    /**
19
     * @var string
20
     */
21
    protected $composerOptions = '--prefer-dist';
22
23
    public function getTitle()
24
    {
25
        return 'use Composer to install requirements.';
26
    }
27
28
    public function getDescription()
29
    {
30
        return '';
31
    }
32
33
    public function runActualTask($params = []): ?string
34
    {
35
        $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

35
        $this->mu()->/** @scrutinizer ignore-call */ setBreakOnAllErrors(true);
Loading history...
36
        $command = 'composer install ' . $this->composerOptions;
37
        $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

37
        $this->mu()->/** @scrutinizer ignore-call */ execMe(
Loading history...
38
            $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

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