|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace ShopwareEnvironmentVariables\Source\Config; |
|
4
|
|
|
|
|
5
|
|
|
use Shopware\Components\Plugin\ConfigReader; |
|
|
|
|
|
|
6
|
|
|
use Shopware\Models\Shop\Shop; |
|
|
|
|
|
|
7
|
|
|
use ShopwareEnvironmentVariables\Source\Helper\ShopProvider; |
|
8
|
|
|
|
|
9
|
|
|
class Reader implements ConfigReader |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @var ConfigReader |
|
13
|
|
|
*/ |
|
14
|
|
|
private $configReader; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @var array |
|
18
|
|
|
*/ |
|
19
|
|
|
private $customEnvironmentVariables; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var ShopProvider |
|
23
|
|
|
*/ |
|
24
|
|
|
private $shopProvider; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @param ConfigReader $configReader |
|
28
|
|
|
* @param ShopProvider $shopProvider |
|
29
|
|
|
* @param array $customEnvironmentVariables |
|
30
|
|
|
*/ |
|
31
|
|
|
public function __construct( |
|
32
|
|
|
ConfigReader $configReader, |
|
33
|
|
|
ShopProvider $shopProvider, |
|
34
|
|
|
array $customEnvironmentVariables |
|
35
|
|
|
) { |
|
36
|
|
|
$this->configReader = $configReader; |
|
37
|
|
|
$this->customEnvironmentVariables = []; |
|
38
|
|
|
if (isset($customEnvironmentVariables['plugins'])) { |
|
39
|
|
|
$this->customEnvironmentVariables = $customEnvironmentVariables['plugins']; |
|
40
|
|
|
} |
|
41
|
|
|
$this->shopProvider = $shopProvider; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @param string $pluginName |
|
46
|
|
|
* @param Shop|null $shop |
|
47
|
|
|
* @return array |
|
48
|
|
|
*/ |
|
49
|
|
|
public function getByPluginName($pluginName, Shop $shop = null): array |
|
50
|
|
|
{ |
|
51
|
|
|
$result = $this->configReader->getByPluginName($pluginName, $shop); |
|
52
|
|
|
$shopId = $shop !== null ? $shop->getId() : $this->shopProvider->getShopId(); |
|
53
|
|
|
|
|
54
|
|
|
if (!isset($this->customEnvironmentVariables[$shopId][$pluginName])) { |
|
55
|
|
|
return $result; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return array_merge($result, $this->customEnvironmentVariables[$shopId][$pluginName]); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
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