@@ 23-29 (lines=7) @@ | ||
20 | { |
|
21 | $transport = $serviceLocator->get($config['transport']); |
|
22 | ||
23 | if (!$transport instanceof Transport) { |
|
24 | throw new ServiceNotCreatedException(sprintf( |
|
25 | "The transport must be an instance of %s, %s given", |
|
26 | Transport::class, |
|
27 | is_object($transport) ? get_class($transport) : gettype($transport) |
|
28 | )); |
|
29 | } |
|
30 | $endpoint = $serviceLocator->get($config['endpoint']); |
|
31 | return new Client($transport, $endpoint); |
|
32 | } |
@@ 37-43 (lines=7) @@ | ||
34 | $selector = $this->getServiceOrClassObject($serviceLocator, $config['selector']); |
|
35 | $connectionFactory = $this->getServiceOrClassObject($serviceLocator, $config['connection_factory']); |
|
36 | ||
37 | if (!$connectionFactory instanceof ConnectionFactoryInterface) { |
|
38 | throw new ServiceNotCreatedException(sprintf( |
|
39 | "The connection factory must be an instace of %s, %s, given", |
|
40 | ConnectionFactoryInterface::class, |
|
41 | is_object($connectionFactory) ? get_class($connectionFactory) : gettype($connectionFactory) |
|
42 | )); |
|
43 | } |
|
44 | $parameters = isset($config['parameters']) ? $config['parameters'] : []; |
|
45 | $connections = $this->getConnectionsFromConfiguration($config, $connectionFactory); |
|
46 | return new $className( |
@@ 25-31 (lines=7) @@ | ||
22 | $sniffOnStart = isset($config['sniff_on_start']) ? $config['sniff_on_start'] : false; |
|
23 | $connectionPool = $serviceLocator->get($config['connection_pool']); |
|
24 | ||
25 | if (!$connectionPool instanceof AbstractConnectionPool) { |
|
26 | throw new ServiceNotCreatedException(sprintf( |
|
27 | "The connection pool must be an instance of %s, %s given", |
|
28 | AbstractConnectionPool::class, |
|
29 | is_object($connectionPool) ? get_class($connectionPool) : gettype($connectionPool) |
|
30 | )); |
|
31 | } |
|
32 | $loggers = $serviceLocator->get($config['loggers']); |
|
33 | ||
34 | return new Transport($retries, $sniffOnStart, $connectionPool, $loggers['logger']); |