Total Complexity | 3 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class ConfigurationResolver implements ConfigurationResolverInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var Configuration[] |
||
14 | */ |
||
15 | private $configurations; |
||
16 | |||
17 | /** |
||
18 | * @var Configuration|null |
||
19 | */ |
||
20 | private $default; |
||
21 | |||
22 | /** |
||
23 | * ConfigurationResolver constructor. |
||
24 | * |
||
25 | * @param Configuration[] $configurations |
||
26 | * @param Configuration|null $default |
||
27 | */ |
||
28 | public function __construct(array $configurations = [], ?Configuration $default = null) |
||
32 | } |
||
33 | |||
34 | /** |
||
|
|||
35 | * {@inheritDoc} |
||
36 | */ |
||
37 | public function getConfiguration(string $connectionName): ?Configuration |
||
38 | { |
||
39 | return $this->configurations[$connectionName] ?? $this->default; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Declare a configuration of a connection |
||
44 | * |
||
45 | * @param string $connectionName |
||
46 | * @param Configuration $configuration |
||
47 | */ |
||
48 | public function addConfiguration(string $connectionName, Configuration $configuration): void |
||
51 | } |
||
52 | } |