1 | <?php |
||||||
2 | |||||||
3 | namespace ThinkOne\NovaFlexibleContentFieldShortcode; |
||||||
4 | |||||||
5 | use Illuminate\Support\Facades\View; |
||||||
6 | use Illuminate\Support\Str; |
||||||
7 | |||||||
8 | abstract class ViewPresenter implements ShortcodePresenter |
||||||
9 | { |
||||||
10 | protected string $viewPath = ''; |
||||||
11 | |||||||
12 | protected array $viewParams = []; |
||||||
13 | |||||||
14 | 2 | public function render(string $key, array $attributes = [], array $options = []): string |
|||||
15 | { |
||||||
16 | 2 | return View::make( |
|||||
17 | 2 | $this->viewPath($key, $attributes, $options), |
|||||
18 | 2 | $this->viewParams($key, $attributes, $options), |
|||||
19 | 2 | )->render(); |
|||||
20 | } |
||||||
21 | |||||||
22 | 2 | public function viewPath(string $key, array $attributes = [], array $options = []): string |
|||||
0 ignored issues
–
show
The parameter
$attributes 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
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() The parameter
$options 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
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
23 | { |
||||||
24 | 2 | if (!$this->viewPath) { |
|||||
25 | 1 | return 'shortcodes.' . Str::kebab(class_basename(get_called_class())); |
|||||
26 | } |
||||||
27 | |||||||
28 | 1 | return $this->viewPath; |
|||||
29 | } |
||||||
30 | |||||||
31 | 2 | public function viewParams(string $key, array $attributes = [], array $options = []): array |
|||||
0 ignored issues
–
show
The parameter
$key 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
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
32 | { |
||||||
33 | 2 | return [ |
|||||
34 | 2 | 'shortcodeData' => array_merge( |
|||||
35 | 2 | $this->viewParams, |
|||||
36 | 2 | $options, |
|||||
37 | 2 | $attributes, |
|||||
38 | 2 | ), |
|||||
39 | 2 | ]; |
|||||
40 | } |
||||||
41 | } |
||||||
42 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.