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

SuggestImportSolution::getRunButtonText()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
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
         return implode(PHP_EOL, $output);
33
    }
34
     public function getRunButtonText(): string
35
    {
36
        return 'Import class';
37
    }
38
39
    public function getDocumentationLinks(): array
40
    {
41
        return [];
42
    }
43
44
    public function getRunParameters(): array
45
    {
46
        return [
47
            'class' => $this->class,
48
        ];
49
    }
50
51
    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...
52
    {
53
        return false;
54
        //return $this->makeOptional($this->getRunParameters()) !== false;
55
    }
56
57
    public function run(array $parameters = [])
58
    {
59
        $output = $this->importClass($parameters);
60
        if ($output !== false) {
61
            file_put_contents($parameters['viewFile'], $output);
62
        }
63
    }
64
65
    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...
66
    {
67
        return false;
68
    }
69
}
70