| Conditions | 3 |
| Paths | 4 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 1 | public function __invoke(array $options) |
|
| 14 | { |
||
| 15 | 1 | $connectionString = (string) ($options['connectionString'] ?? ''); |
|
| 16 | 1 | $timeout = (float) ($options['timeout'] ?? ini_get('default_socket_timeout')); |
|
| 17 | 1 | $writeTimeout = (int) ($options['writeTimeout'] ?? ini_get('default_socket_timeout')); |
|
| 18 | 1 | $level = (int) ($options['level'] ?? Logger::DEBUG); |
|
| 19 | 1 | $bubble = (bool) ($options['bubble'] ?? true); |
|
| 20 | |||
| 21 | 1 | $handler = new SocketHandler( |
|
| 22 | 1 | $connectionString, |
|
| 23 | 1 | $level, |
|
| 24 | 1 | $bubble |
|
| 25 | ); |
||
| 26 | |||
| 27 | 1 | if (!empty($timeout)) { |
|
| 28 | 1 | $handler->setConnectionTimeout($timeout); |
|
| 29 | } |
||
| 30 | |||
| 31 | 1 | if (!empty($writeTimeout)) { |
|
| 32 | 1 | $handler->setTimeout($writeTimeout); |
|
| 33 | 1 | $handler->setWritingTimeout($writeTimeout); |
|
| 34 | } |
||
| 35 | |||
| 36 | 1 | return $handler; |
|
| 37 | } |
||
| 38 | } |
||
| 39 |