| Conditions | 3 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 5 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 24 | 3 | public function meet(array $nodeUrls) |
|
| 25 | { |
||
| 26 | 3 | $current = $this->stream->getNodeUrl(); |
|
| 27 | |||
| 28 | 3 | return array_filter($nodeUrls, function($url) use ($current) { |
|
| 29 | 3 | if ($url === $current) { |
|
| 30 | 1 | return true; |
|
| 31 | } |
||
| 32 | |||
| 33 | 2 | $parts = parse_url($url); |
|
| 34 | |||
| 35 | try { |
||
| 36 | 2 | $response = $this->send(['CLUSTER', 'MEET', $parts['host'], (int) $parts['port']]); |
|
| 37 | 2 | $this->log->debug('CLUSTER MEET', ['host' => $url, 'response' => $response]); |
|
| 38 | 2 | return 'OK' === $response; |
|
| 39 | 1 | } catch (Exception $e) { |
|
| 40 | 1 | $this->log->error($e->getMessage(), array('url' => $url, 'exception' => $e)); |
|
| 41 | 1 | return false; |
|
| 42 | } |
||
| 43 | 3 | }); |
|
| 44 | } |
||
| 45 | } |
||
| 46 |