Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function getOptionsFor(string $identifier) |
||
27 | { |
||
28 | $defaultOptions = $this->config->get('circuit_breaker.defaults'); |
||
29 | $serviceOptionsMap = $this->config->get('circuit_breaker.services'); |
||
30 | |||
31 | if (array_key_exists($identifier, $serviceOptionsMap)) { |
||
32 | $serviceOptions = array_merge($defaultOptions, $serviceOptionsMap[$identifier]); |
||
33 | |||
34 | return ServiceOptions::createFromOptions( |
||
35 | $serviceOptions['attempts_threshold'], |
||
36 | $serviceOptions['attempts_ttl'], |
||
37 | $serviceOptions['failure_ttl'] |
||
38 | ); |
||
39 | } |
||
40 | |||
41 | return ServiceOptions::createFromOptions( |
||
42 | $defaultOptions['attempts_threshold'], |
||
43 | $defaultOptions['attempts_ttl'], |
||
44 | $defaultOptions['failure_ttl'] |
||
45 | ); |
||
46 | } |
||
47 | } |
||
48 |