1 | <?php |
||
2 | /** |
||
3 | * Copyright © O2TI. All rights reserved. |
||
4 | * |
||
5 | * @author Bruno Elisei <[email protected]> |
||
6 | * See COPYING.txt for license details. |
||
7 | */ |
||
8 | |||
9 | namespace O2TI\AdvancedStreetAddress\Helper; |
||
10 | |||
11 | use Magento\Framework\App\Config\ScopeConfigInterface; |
||
12 | use Magento\Framework\App\Helper\AbstractHelper; |
||
13 | use Magento\Store\Model\ScopeInterface; |
||
14 | use Magento\Store\Model\StoreManagerInterface; |
||
15 | |||
16 | /** |
||
17 | * Class Config - Helper configuration. |
||
18 | */ |
||
19 | class Config extends AbstractHelper |
||
20 | { |
||
21 | public const CONFIG_PATH_GENERAL = 'advanced_street_address/general/%s'; |
||
22 | |||
23 | public const CONFIG_PATH_ARRAY_LABEL = 'advanced_street_address/general/street_%s/label/%s'; |
||
24 | |||
25 | public const CONFIG_PATH_ARRAY_VALIDATION = 'advanced_street_address/general/street_%s/validation/%s'; |
||
26 | |||
27 | /** |
||
28 | * @var mapArrayName |
||
0 ignored issues
–
show
|
|||
29 | */ |
||
30 | private $mapArrayName = [ |
||
31 | 0 => 'first', |
||
32 | 1 => 'second', |
||
33 | 2 => 'third', |
||
34 | 3 => 'fourth', |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * @var ScopeConfigInterface |
||
39 | */ |
||
40 | protected $scopeConfig; |
||
41 | |||
42 | /** |
||
43 | * @var StoreManagerInterface |
||
44 | */ |
||
45 | protected $storeManagerInterface; |
||
46 | |||
47 | /** |
||
48 | * @param ScopeConfigInterface $scopeConfig |
||
49 | * @param StoreManagerInterface $storeManagerInterface |
||
50 | */ |
||
51 | public function __construct( |
||
52 | ScopeConfigInterface $scopeConfig, |
||
53 | StoreManagerInterface $storeManagerInterface |
||
54 | ) { |
||
55 | $this->scopeConfig = $scopeConfig; |
||
56 | $this->storeManagerInterface = $storeManagerInterface; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Get Configs Module. |
||
61 | * |
||
62 | * @param string $field |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getConfigModule(string $field): ?string |
||
67 | { |
||
68 | $storeId = $this->storeManagerInterface->getStore()->getId(); |
||
69 | $configPath = sprintf(self::CONFIG_PATH_GENERAL, $field); |
||
70 | |||
71 | return $this->scopeConfig->getValue($configPath, ScopeInterface::SCOPE_STORE, $storeId); |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * Get Configs For Label. |
||
76 | * |
||
77 | * @param int $position |
||
78 | * @param string $field |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getConfigForLabel(int $position, string $field): ?string |
||
83 | { |
||
84 | $arrayName = $this->mapArrayName[$position]; |
||
85 | $storeId = $this->storeManagerInterface->getStore()->getId(); |
||
86 | $configPath = sprintf(self::CONFIG_PATH_ARRAY_LABEL, $arrayName, $field); |
||
87 | |||
88 | return $this->scopeConfig->getValue($configPath, ScopeInterface::SCOPE_STORE, $storeId); |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Get Configs For Validation. |
||
93 | * |
||
94 | * @param int $position |
||
95 | * @param string $field |
||
96 | * |
||
97 | * @return int |
||
98 | */ |
||
99 | public function getConfigForValidation(int $position, string $field): ?int |
||
100 | { |
||
101 | $arrayName = $this->mapArrayName[$position]; |
||
102 | $storeId = $this->storeManagerInterface->getStore()->getId(); |
||
103 | $configPath = sprintf(self::CONFIG_PATH_ARRAY_VALIDATION, $arrayName, $field); |
||
104 | |||
105 | return $this->scopeConfig->getValue($configPath, ScopeInterface::SCOPE_STORE, $storeId); |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * If module is Enabled. |
||
110 | * |
||
111 | * @return bool |
||
112 | */ |
||
113 | public function isEnabled(): ?bool |
||
114 | { |
||
115 | return $this->getConfigModule('enabled'); |
||
0 ignored issues
–
show
|
|||
116 | } |
||
117 | } |
||
118 |
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