Completed
Pull Request — master (#48)
by James
01:18
created

SuggestImportSolution::getRunParameters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Facade\Ignition\Solutions;
4
5
use Facade\IgnitionContracts\RunnableSolution;
6
7
class SuggestImportSolution implements RunnableSolution
8
{
9
    /** @var string */
10
    protected $class;
11
12
    public function __construct(string $class = null)
13
    {
14
        $this->class = $class;
15
    }
16
17
    public function getSolutionTitle(): string
18
    {
19
        return 'A class import is missing';
20
    }
21
22
    public function getSolutionDescription(): string
23
    {
24
        return '';
25
    }
26
27
    public function getSolutionActionDescription(): string
28
    {
29
        $output = [
30
            'You have a missing class import. Try importing this class: `'.$this->class.'`.',
31
        ];
32
33
        return implode(PHP_EOL, $output);
34
    }
35
36
    public function getRunButtonText(): string
37
    {
38
        return 'Import class';
39
    }
40
41
    public function getDocumentationLinks(): array
42
    {
43
        return [];
44
    }
45
46
    public function getRunParameters(): array
47
    {
48
        return [
49
            'class' => $this->class,
50
        ];
51
    }
52
53
    public function isRunnable(array $parameters = [])
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed.

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

Loading history...
54
    {
55
        return false;
56
        //return $this->makeOptional($this->getRunParameters()) !== false;
57
    }
58
59
    public function run(array $parameters = [])
60
    {
61
        $output = $this->importClass($parameters);
62
        if ($output !== false) {
63
            file_put_contents($parameters['viewFile'], $output);
64
        }
65
    }
66
67
    public function importClass(array $parameters = [])
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed.

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

Loading history...
68
    {
69
        return false;
70
    }
71
}
72