1 | <?php |
||||
2 | declare(strict_types=1); |
||||
3 | |||||
4 | /* |
||||
5 | * Copyright (C) |
||||
6 | * Nathan Boiron <[email protected]> |
||||
7 | * Romain Canon <[email protected]> |
||||
8 | * |
||||
9 | * This file is part of the TYPO3 NotiZ project. |
||||
10 | * It is free software; you can redistribute it and/or modify it |
||||
11 | * under the terms of the GNU General Public License, either |
||||
12 | * version 3 of the License, or any later version. |
||||
13 | * |
||||
14 | * For the full copyright and license information, see: |
||||
15 | * http://www.gnu.org/licenses/gpl-3.0.html |
||||
16 | */ |
||||
17 | |||||
18 | namespace CuyZ\Notiz\View\Slot; |
||||
19 | |||||
20 | use CuyZ\Notiz\Core\Definition\DefinitionService; |
||||
21 | use CuyZ\Notiz\Core\Definition\Tree\EventGroup\Event\EventDefinition; |
||||
22 | use CuyZ\Notiz\ViewHelpers\Slot\SlotViewHelper; |
||||
23 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
||||
24 | use TYPO3\CMS\Fluid\View\StandaloneView; |
||||
0 ignored issues
–
show
|
|||||
25 | |||||
26 | class SlotView extends StandaloneView |
||||
27 | { |
||||
28 | const SLOT_CONTAINER = 'SlotContainer'; |
||||
29 | const SLOT_VALUES = 'SlotValues'; |
||||
30 | const MARKERS = 'Marker'; |
||||
31 | |||||
32 | /** |
||||
33 | * @var SlotContainer |
||||
34 | */ |
||||
35 | protected $slots; |
||||
36 | |||||
37 | /** |
||||
38 | * @var EventDefinition |
||||
39 | */ |
||||
40 | protected $eventDefinition; |
||||
41 | |||||
42 | /** |
||||
43 | * @param EventDefinition $eventDefinition |
||||
44 | */ |
||||
45 | public function __construct(EventDefinition $eventDefinition) |
||||
46 | { |
||||
47 | parent::__construct(); |
||||
48 | |||||
49 | $this->eventDefinition = $eventDefinition; |
||||
50 | } |
||||
51 | |||||
52 | /** |
||||
53 | * Will render the section `Slots` of the view. This will allow collecting |
||||
54 | * all the slots for the event, that are then returned. |
||||
55 | * |
||||
56 | * @return SlotContainer |
||||
57 | */ |
||||
58 | public function getSlots(): SlotContainer |
||||
59 | { |
||||
60 | if (!$this->slots) { |
||||
61 | $this->slots = GeneralUtility::makeInstance(SlotContainer::class); |
||||
62 | |||||
63 | $this->baseRenderingContext |
||||
64 | ->getViewHelperVariableContainer() |
||||
65 | ->add(SlotViewHelper::class, SlotViewHelper::SLOT_CONTAINER, $this->slots); |
||||
66 | |||||
67 | $variables = [ |
||||
68 | 'event' => $this->eventDefinition, |
||||
69 | 'definition' => DefinitionService::get()->getDefinition(), |
||||
0 ignored issues
–
show
It seems like
getDefinition() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
70 | ]; |
||||
71 | |||||
72 | $this->renderSection('Slots', $variables, true); |
||||
73 | } |
||||
74 | |||||
75 | return $this->slots; |
||||
76 | } |
||||
77 | |||||
78 | /** |
||||
79 | * @param array $slotsValues |
||||
80 | * @param array $markers |
||||
81 | * @return string |
||||
82 | */ |
||||
83 | public function renderWithSlots(array $slotsValues, array $markers): string |
||||
84 | { |
||||
85 | $viewHelperVariableContainer = $this->baseRenderingContext->getViewHelperVariableContainer(); |
||||
86 | |||||
87 | $viewHelperVariableContainer->add(self::class, self::SLOT_CONTAINER, $this->getSlots()); |
||||
88 | $viewHelperVariableContainer->add(self::class, self::SLOT_VALUES, $slotsValues); |
||||
89 | $viewHelperVariableContainer->add(self::class, self::MARKERS, $markers); |
||||
90 | |||||
91 | return $this->render(); |
||||
92 | } |
||||
93 | |||||
94 | /** |
||||
95 | * @return EventDefinition |
||||
96 | */ |
||||
97 | public function getEventDefinition(): EventDefinition |
||||
98 | { |
||||
99 | return $this->eventDefinition; |
||||
100 | } |
||||
101 | } |
||||
102 |
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