Passed
Push — master ( f01d00...2f7647 )
by Nicolaas
03:27
created

Reorganise::hasCommitAndPush()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Sunnysideup\UpgradeToSilverstripe4\Tasks\IndividualTasks;
4
5
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Task;
6
7
/**
8
 * Runs the silverstripe/upgrade task "reorganise". See:
9
 * https://github.com/silverstripe/silverstripe-upgrader#reorganise
10
 * You can use this command to reorganise your folder structure to
11
 * conform to the new structure introduced with SilverStripe 4.1.
12
 * Your mysite folder will be renamed to app and your code folder will be rename to src.
13
 */
14
class Reorganise extends Task
15
{
16
    protected $taskStep = 's50';
17
18
    protected $param1 = '';
19
20
    protected $param2 = '';
21
22
    protected $rootDirForCommand = '';
23
24
    protected $settings = '';
25
26
    public function getTitle()
27
    {
28
        return 'move mysite/code folder to app/src';
29
    }
30
31
    public function getDescription()
32
    {
33
        return '
34
            Runs the silverstripe/upgrade task "reorganise". See:
35
            https://github.com/silverstripe/silverstripe-upgrader#reorganise
36
            You can use this command to reorganise your folder structure to
37
            conform to the new structure introduced with SilverStripe 4.1.
38
            Your mysite folder will be renamed to app and your code folder will be renamed to src.
39
            ';
40
    }
41
42
    public function runActualTask($params = [])
43
    {
44
        if ($this->mu()->getIsModuleUpgrade()) {
0 ignored issues
show
Bug introduced by
The method getIsModuleUpgrade() does not exist on Sunnysideup\UpgradeToSilverstripe4\ModuleUpgrader. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

44
        if ($this->mu()->/** @scrutinizer ignore-call */ getIsModuleUpgrade()) {
Loading history...
45
        } else {
46
            $this->runSilverstripeUpgradeTask(
47
                'reorganise',
48
                $this->param1,
49
                $this->param2,
50
                $this->rootDirForCommand,
51
                $this->settings
52
            );
53
            $this->setCommitMessage('MAJOR: re-organising files');
54
        }
55
    }
56
57
    protected function hasCommitAndPush()
58
    {
59
        if ($this->mu()->getIsModuleUpgrade()) {
60
            return false;
61
        }
62
63
        return true;
64
    }
65
}
66