| 1 | <?php |
||
| 13 | class TransportFactory extends AbstractFactory |
||
| 14 | { |
||
| 15 | use InvalidTypeExceptionTrait; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * {@inheritDoc} |
||
| 19 | */ |
||
| 20 | 11 | protected function create(ContainerInterface $container, $config) |
|
| 21 | { |
||
| 22 | 11 | $retries = isset($config['retries']) ? $config['retries'] : 2; |
|
| 23 | 11 | $sniffOnStart = isset($config['sniff_on_start']) ? $config['sniff_on_start'] : false; |
|
| 24 | 11 | $connectionPool = $container->get($config['connection_pool']); |
|
| 25 | |||
| 26 | 11 | if (!$connectionPool instanceof AbstractConnectionPool) { |
|
| 27 | 1 | throw $this->getException( |
|
| 28 | 1 | 'connection pool', |
|
| 29 | 1 | AbstractConnectionPool::class, |
|
| 30 | 1 | ServiceNotCreatedException::class, |
|
| 31 | $connectionPool |
||
| 32 | 1 | ); |
|
| 33 | } |
||
| 34 | 10 | $loggers = $container->get($config['loggers']); |
|
| 35 | |||
| 36 | 10 | return new Transport($retries, $sniffOnStart, $connectionPool, $loggers['logger']); |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * {@inheritDoc} |
||
| 41 | */ |
||
| 42 | 11 | public function getServiceType() |
|
| 46 | } |
||
| 47 |