|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace RedirectionIO\Client\ProxySymfony\DependencyInjection; |
|
4
|
|
|
|
|
5
|
|
|
use RedirectionIO\Client\ProxySymfony\CircuitBreaker\CircuitBreakerInterface; |
|
6
|
|
|
use RedirectionIO\Client\ProxySymfony\CircuitBreaker\HostBreaker; |
|
7
|
|
|
use RedirectionIO\Client\ProxySymfony\CircuitBreaker\PathInfoPrefixBreaker; |
|
8
|
|
|
use RedirectionIO\Client\ProxySymfony\EventListener\RequestResponseListener; |
|
9
|
|
|
use RedirectionIO\Client\Sdk\Client; |
|
10
|
|
|
use Symfony\Component\Config\FileLocator; |
|
|
|
|
|
|
11
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
|
|
|
|
|
12
|
|
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
|
|
|
|
|
|
13
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @internal |
|
17
|
|
|
*/ |
|
18
|
|
|
final class RedirectionIOExtension extends Extension |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* {@inheritdoc} |
|
22
|
|
|
*/ |
|
23
|
|
|
public function load(array $configs, ContainerBuilder $container) |
|
24
|
|
|
{ |
|
25
|
|
|
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
26
|
|
|
$loader->load('services.xml'); |
|
27
|
|
|
|
|
28
|
|
|
$configuration = new Configuration(); |
|
29
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
|
30
|
|
|
|
|
31
|
|
|
foreach ($config['connections'] as $name => $connection) { |
|
32
|
|
|
$connections[$name] = $container->resolveEnvPlaceholders($connection); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
$container |
|
36
|
|
|
->getDefinition(Client::class) |
|
37
|
|
|
->replaceArgument(0, $config['project_key']) |
|
38
|
|
|
->replaceArgument(1, $connections) |
|
|
|
|
|
|
39
|
|
|
->replaceArgument(3, $config['debug']) |
|
40
|
|
|
->replaceArgument(5, $config['persist']) |
|
41
|
|
|
; |
|
42
|
|
|
|
|
43
|
|
|
$container |
|
44
|
|
|
->getDefinition(RequestResponseListener::class) |
|
45
|
|
|
->replaceArgument(1, $config['match_on_response']) |
|
46
|
|
|
; |
|
47
|
|
|
|
|
48
|
|
|
if ($config['excluded_prefixes']) { |
|
49
|
|
|
$container |
|
50
|
|
|
->getDefinition(PathInfoPrefixBreaker::class) |
|
51
|
|
|
->replaceArgument(0, $config['excluded_prefixes']) |
|
52
|
|
|
; |
|
53
|
|
|
} else { |
|
54
|
|
|
$container->removeDefinition(PathInfoPrefixBreaker::class); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
if ($config['excluded_hosts']) { |
|
58
|
|
|
$container |
|
59
|
|
|
->getDefinition(HostBreaker::class) |
|
60
|
|
|
->replaceArgument(0, $config['excluded_hosts']) |
|
61
|
|
|
; |
|
62
|
|
|
} else { |
|
63
|
|
|
$container->removeDefinition(HostBreaker::class); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
if (method_exists($container, 'registerForAutoconfiguration')) { |
|
67
|
|
|
$container |
|
68
|
|
|
->registerForAutoconfiguration(CircuitBreakerInterface::class) |
|
69
|
|
|
->addTag('redirectionio.circuit_breaker') |
|
70
|
|
|
; |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
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