|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* Copyright Humbly Arrogant Ltd 2020-2022. |
|
7
|
|
|
* |
|
8
|
|
|
* Use of this software is governed by the Business Source License included in the LICENSE file and at https://getparthenon.com/docs/next/license. |
|
9
|
|
|
* |
|
10
|
|
|
* Change Date: TBD ( 3 years after 2.0.0 release ) |
|
11
|
|
|
* |
|
12
|
|
|
* On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license specified in the LICENSE file. |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace Parthenon\DependencyInjection\Modules; |
|
16
|
|
|
|
|
17
|
|
|
use Symfony\Component\Config\Definition\Builder\NodeBuilder; |
|
18
|
|
|
use Symfony\Component\Config\FileLocator; |
|
19
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
|
|
|
|
|
20
|
|
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
|
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
final class Cloud implements ModuleConfigurationInterface |
|
23
|
|
|
{ |
|
24
|
|
|
public function addConfig(NodeBuilder $nodeBuilder): void |
|
25
|
|
|
{ |
|
26
|
|
|
$nodeBuilder->arrayNode('cloud') |
|
27
|
|
|
->children() |
|
28
|
|
|
->booleanNode('enabled')->defaultFalse()->end() |
|
29
|
|
|
->arrayNode('digitalocean') |
|
|
|
|
|
|
30
|
|
|
->children() |
|
31
|
|
|
->scalarNode('api_key')->end() |
|
32
|
|
|
?->end() |
|
33
|
|
|
->end() |
|
34
|
|
|
->end(); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function handleDefaultParameters(ContainerBuilder $container): void |
|
38
|
|
|
{ |
|
39
|
|
|
$container->setParameter('parthenon_cloud_digitalocean_apikey', ''); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function handleConfiguration(array $config, ContainerBuilder $container): void |
|
43
|
|
|
{ |
|
44
|
|
|
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config')); |
|
45
|
|
|
|
|
46
|
|
|
if (!isset($config['cloud']) || !isset($config['cloud']['enabled']) || false === $config['cloud']['enabled']) { |
|
47
|
|
|
return; |
|
48
|
|
|
} |
|
49
|
|
|
$loader->load('services/cloud.xml'); |
|
50
|
|
|
$this->handleDigitalOcean($config, $container); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
private function handleDigitalOcean(array $config, ContainerBuilder $containerBuilder): void |
|
54
|
|
|
{ |
|
55
|
|
|
if (!isset($config['cloud']['digitalocean'])) { |
|
56
|
|
|
return; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
$digitalOceanConfig = $config['cloud']['digitalocean']; |
|
60
|
|
|
|
|
61
|
|
|
$containerBuilder->setParameter('parthenon_cloud_digitalocean_apikey', $digitalOceanConfig['api_key'] ?? ''); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
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