RewriteConstructors   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
c 1
b 0
f 0
dl 0
loc 29
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 3 1
A getTitle() 0 3 1
A hasCommitAndPush() 0 3 1
A runActualTask() 0 9 1
1
<?php
2
3
namespace Sunnysideup\UpgradeToSilverstripe4\Tasks\IndividualTasks;
4
5
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Task;
6
7
/**
8
 * Delete the web root directory to allow for a fresh install.
9
 */
10
class RewriteConstructors extends Task
11
{
12
    protected $taskStep = 's00';
13
14
    public function getTitle()
15
    {
16
        return 'Constructor rewrite';
17
    }
18
19
    public function getDescription()
20
    {
21
        return '
22
            rewrites deprecated constructors to be compatible with PHP7.';
23
    }
24
25
    public function runActualTask($params = []): ?string
26
    {
27
        $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

27
        $this->mu()->/** @scrutinizer ignore-call */ execMe(
Loading history...
28
            $this->mu()->getAboveWebRootDirLocation(),
0 ignored issues
show
Bug introduced by
The method getAboveWebRootDirLocation() 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

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

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

28
            $this->mu()->/** @scrutinizer ignore-call */ getAboveWebRootDirLocation(),
Loading history...
29
            'php ' . $this->mu()->getWebRootDirLocation() . '--disable-class-file-create',
0 ignored issues
show
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

29
            'php ' . $this->mu()->/** @scrutinizer ignore-call */ getWebRootDirLocation() . '--disable-class-file-create',
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

29
            'php ' . $this->mu()->/** @scrutinizer ignore-call */ getWebRootDirLocation() . '--disable-class-file-create',
Loading history...
30
            'create upgrade directory: ' . $this->mu()->getWebRootDirLocation(),
31
            false
32
        );
33
        return null;
34
    }
35
36
    protected function hasCommitAndPush()
37
    {
38
        return false;
39
    }
40
}
41