1 | <?php |
||
2 | |||
3 | namespace DnVariantSwitch\Subscriber; |
||
4 | |||
5 | use Doctrine\Common\Collections\ArrayCollection; |
||
0 ignored issues
–
show
|
|||
6 | use Enlight\Event\SubscriberInterface; |
||
0 ignored issues
–
show
The type
Enlight\Event\SubscriberInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
7 | |||
8 | /** |
||
9 | * Class TemplateRegistration |
||
10 | * @package DnVariantSwitch\Subscriber |
||
11 | */ |
||
12 | class TemplateRegistration implements SubscriberInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $pluginDirectory; |
||
18 | |||
19 | /** |
||
20 | * @var \Enlight_Template_Manager |
||
0 ignored issues
–
show
The type
Enlight_Template_Manager was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
21 | */ |
||
22 | private $templateManager; |
||
23 | |||
24 | /** |
||
25 | * @var \Shopware_Components_Snippet_Manager |
||
0 ignored issues
–
show
The type
Shopware_Components_Snippet_Manager was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
26 | */ |
||
27 | private $snippetManager; |
||
28 | |||
29 | /** |
||
30 | * TemplateRegistration constructor. |
||
31 | * @param $pluginDirectory |
||
32 | * @param \Enlight_Template_Manager $templateManager |
||
33 | * @param \Shopware_Components_Snippet_Manager $snippetManager |
||
34 | */ |
||
35 | public function __construct( |
||
36 | $pluginDirectory, |
||
37 | \Enlight_Template_Manager $templateManager, |
||
38 | \Shopware_Components_Snippet_Manager $snippetManager |
||
39 | ) |
||
40 | { |
||
41 | $this->pluginDirectory = $pluginDirectory; |
||
42 | $this->templateManager = $templateManager; |
||
43 | $this->snippetManager = $snippetManager; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public static function getSubscribedEvents() |
||
50 | { |
||
51 | return [ |
||
52 | 'Enlight_Controller_Action_PreDispatch' => 'onPreDispatch', |
||
53 | 'Theme_Compiler_Collect_Plugin_Javascript' => 'addJsFiles', |
||
54 | ]; |
||
55 | } |
||
56 | |||
57 | public function onPreDispatch() |
||
58 | { |
||
59 | $this->templateManager->addTemplateDir($this->pluginDirectory . '/Resources/views'); |
||
60 | $this->snippetManager->addConfigDir($this->pluginDirectory . '/Resources/snippets/'); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @return \Doctrine\Common\Collections\ArrayCollection |
||
65 | */ |
||
66 | public function addJsFiles() |
||
67 | { |
||
68 | $jsFiles = [ |
||
69 | $this->pluginDirectory . '/Resources/views/frontend/_public/src/js/jquery.off-canvas-variant-switch.js', |
||
70 | $this->pluginDirectory . '/Resources/views/frontend/_public/src/js/jquery.variant-switch.js', |
||
71 | ]; |
||
72 | |||
73 | return new ArrayCollection($jsFiles); |
||
74 | } |
||
75 | } |
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