1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Riclep\Storyblok\Exceptions; |
4
|
|
|
|
5
|
|
|
use Exception; |
6
|
|
|
use Facade\IgnitionContracts\Solution; |
|
|
|
|
7
|
|
|
use Facade\IgnitionContracts\BaseSolution; |
|
|
|
|
8
|
|
|
use Facade\IgnitionContracts\ProvidesSolution; |
|
|
|
|
9
|
|
|
use Illuminate\Support\Str; |
10
|
|
|
use Riclep\Storyblok\Solutions\CreateMissingBlockSolution; |
11
|
|
|
|
12
|
|
|
class UnableToRenderException extends Exception implements ProvidesSolution |
13
|
|
|
{ |
14
|
|
|
protected $data; |
15
|
|
|
|
16
|
|
|
public function __construct($message, $data) |
17
|
|
|
{ |
18
|
|
|
parent::__construct($message); |
19
|
|
|
|
20
|
|
|
$this->data = $data; |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** @return \Facade\IgnitionContracts\Solution */ |
24
|
|
|
public function getSolution(): Solution |
25
|
|
|
{ |
26
|
|
|
if (get_class($this->data) === 'App\Storyblok\Block') { |
27
|
|
|
return new CreateMissingBlockSolution($this->data); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
if (count($this->data->_componentPath) === 1) { |
31
|
|
|
if (get_class($this->data) === 'App\Storyblok\Page') { |
32
|
|
|
$title = 'Create a view or custom Page class'; |
33
|
|
|
$description = 'Create one of the following views: `[' . implode(', ', $this->data->views()) . ']` or a create Page class called `App\Storyblok\Pages\\' . Str::studly($this->data->block()->component()) . '` and override the `views()` method implmenting your own view finding logic.'; |
34
|
|
|
} else { |
35
|
|
|
$title = 'Create a view or implement view logic'; |
36
|
|
|
$description = 'Create one of the following views: `[' . implode(', ', $this->data->views()) . ']` or override the `views()` method in `App\Storyblok\Pages\\' . Str::studly($this->data->block()->component()) . '` and implement your own view finding logic.'; |
37
|
|
|
} |
38
|
|
|
} else { |
39
|
|
|
$title = 'Create a view or implement view logic'; |
40
|
|
|
$description = 'Create one of the following views: `[' . implode(', ', $this->data->views()) . ']` or override the `views()` method in `App\Storyblok\Blocks\\' . Str::studly($this->data->meta()['component']) . '` and implement your own view finding logic.'; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
return BaseSolution::create($title) |
44
|
|
|
->setSolutionDescription($description) |
45
|
|
|
->setDocumentationLinks([ |
46
|
|
|
'Laravel Storyblok docs' => 'https://ls.sirric.co.uk/docs/', |
47
|
|
|
]); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
|
51
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths