AddResourceGitIgnore::getDescription()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
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\Task;
7
8
/**
9
 * Runs through the source code and adds hidden Silverstripe property and method documentation to classes
10
 * based on the database array and has many lists
11
 */
12
class AddResourceGitIgnore extends Task
13
{
14
    protected $taskStep = 's60';
15
16
    protected $resourcesFolder = 'resources';
17
18
    protected $string = <<<txt
19
    *
20
    !.htaccess
21
    !.gitignore
22
txt;
23
24
    public function getTitle()
25
    {
26
        return 'Add git ignore to resources folder. TO BE COMPLETED';
27
    }
28
29
    public function getDescription()
30
    {
31
        return 'Adds a gitignore file to the resources folder';
32
    }
33
34
    public function runActualTask($params = []): ?string
35
    {
36
        $dir = $this->mu()->getWebRootDirLocation();
0 ignored issues
show
Unused Code introduced by
The assignment to $dir is dead and can be removed.
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

36
        $dir = $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

36
        $dir = $this->mu()->/** @scrutinizer ignore-call */ getWebRootDirLocation();
Loading history...
37
        return null;
38
    }
39
40
    protected function updateModuleConfigFile(string $moduleName)
0 ignored issues
show
Unused Code introduced by
The parameter $moduleName is not used and could be removed. ( Ignorable by Annotation )

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

40
    protected function updateModuleConfigFile(/** @scrutinizer ignore-unused */ string $moduleName)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
41
    {
42
        // $moduleLocation = $this->findModuleNameLocation($moduleName);
43
44
        // $fileLocation = $this->mu()->getWebRootDirLocation() . '/' . $moduleLocation . '/_config/' . $this->configFileName;
45
        // FileSystemFixes::inst($this->mu())
46
        //     ->removeDirOrFile($fileLocation);
47
        // $ideannotatorConfigForModule = $this->ideannotatorConfig;
48
        // $ideannotatorConfigForModule = str_replace(self::REPLACER, $moduleName, $ideannotatorConfigForModule);
49
        // $this->mu()->execMe(
50
        //     $this->mu()->getWebRootDirLocation(),
51
        //     'echo \'' . str_replace('\'', '"', $ideannotatorConfigForModule) . '\' > ' . $fileLocation,
52
        //     'Adding IDEAnnotator configuration',
53
        //     false
54
        // );
55
        // if (! file_exists($fileLocation)) {
56
        //     user_error('Could not locate ' . $fileLocation);
57
        // }
58
    }
59
60
    protected function hasCommitAndPush(): bool
61
    {
62
        return true;
63
    }
64
}
65