Completed
Pull Request — master (#91)
by Jeroen
01:33
created

CreateControllerSolution::getSolutionTitle()   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\Solution;
6
7
class CreateControllerSolution implements Solution
8
{
9
    /** @var string */
10
    protected $class;
11
12
    public function __construct(string $class)
13
    {
14
        $this->class = $class;
15
    }
16
17
    public function getSolutionTitle(): string
18
    {
19
        return 'The requested controller does not exist';
20
    }
21
22
    public function getSolutionDescription(): string
23
    {
24
        $controller = $this->getControllerPath();
25
26
        return "Your route is pointing to a controller that does not exist. You can create the controller using `php artisan make:controller $controller`.";
27
    }
28
29
    public function getDocumentationLinks(): array
30
    {
31
        return [
32
            'Basics: Controller docs' => 'https://laravel.com/docs/6.0/controllers',
33
        ];
34
    }
35
36
    private function getControllerPath(): string
37
    {
38
        $controller = str_replace('App\\Http\\Controllers\\', '', $this->class);
39
        $controller = str_replace('\\', '/', $controller);
40
41
        return $controller;
42
    }
43
}
44