DoMigrateSiteTreeLinkingTask   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 13
c 1
b 0
f 0
dl 0
loc 35
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getTitle() 0 3 1
A getDescription() 0 3 1
A hasCommitAndPush() 0 3 1
A runActualTask() 0 12 2
1
<?php
2
3
namespace Sunnysideup\UpgradeToSilverstripe4\Tasks\IndividualTasks;
4
5
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Task;
6
7
/**
8
 * Run a dev/build as a smoke test to see if all is well
9
 */
10
class DoMigrateSiteTreeLinkingTask extends Task
11
{
12
    protected $taskStep = 's60';
13
14
    public function getTitle()
15
    {
16
        return 'Run dev/tasks/MigrateSiteTreeLinkingTask';
17
    }
18
19
    public function getDescription()
20
    {
21
        return '
22
            Run a dev/tasks/MigrateSiteTreeLinkingTask to upgrade sitetree links.';
23
    }
24
25
    /**
26
     * @param array $params
27
     */
28
    public function runActualTask($params = []): ?string
29
    {
30
        if ($this->mu()->getIsModuleUpgrade()) {
0 ignored issues
show
Bug introduced by
It seems like getIsModuleUpgrade() 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

30
        if ($this->mu()->/** @scrutinizer ignore-call */ getIsModuleUpgrade()) {
Loading history...
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

30
        if ($this->mu()->/** @scrutinizer ignore-call */ getIsModuleUpgrade()) {
Loading history...
31
            return null;
32
        }
33
        $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

33
        $this->mu()->/** @scrutinizer ignore-call */ execMe(
Loading history...
34
            $this->mu()->getWebRootDirLocation(),
0 ignored issues
show
Bug introduced by
It seems like $this->mu()->getWebRootDirLocation() can also be of type Sunnysideup\UpgradeToSilverstripe4\ModuleUpgrader and Sunnysideup\UpgradeToSilverstripe4\Traits\Creator and null; however, parameter $newDir of Sunnysideup\UpgradeToSil...oduleUpgrader::execMe() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

34
            /** @scrutinizer ignore-type */ $this->mu()->getWebRootDirLocation(),
Loading history...
Bug introduced by
The method getWebRootDirLocation() 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

34
            $this->mu()->/** @scrutinizer ignore-call */ getWebRootDirLocation(),
Loading history...
Bug introduced by
It seems like getWebRootDirLocation() 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

34
            $this->mu()->/** @scrutinizer ignore-call */ getWebRootDirLocation(),
Loading history...
35
            'php vendor/silverstripe/framework/cli-script.php dev/tasks/MigrateSiteTreeLinkingTask flush=all',
36
            'MigrateSiteTreeLinkingTask is running',
37
            false
38
        );
39
        return null;
40
    }
41
42
    protected function hasCommitAndPush()
43
    {
44
        return false;
45
    }
46
}
47