Conditions | 6 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 6.1308 |
Changes | 0 |
1 | <?php |
||
47 | 1 | public function resolve(bool $force = false) : bool |
|
48 | { |
||
49 | 1 | if (!$force && is_array($this->_results)) { |
|
50 | return true; |
||
51 | } |
||
52 | |||
53 | 1 | $this->_results = []; |
|
54 | 1 | foreach ($this->_pool as $address => $type) { |
|
55 | 1 | if (!($result = dns_get_record($address, $type))) { |
|
56 | continue; |
||
57 | } |
||
58 | |||
59 | 1 | $this->_results = array_merge($this->_results, array_map(function ($record) use($type) { |
|
60 | 1 | return $type === DNS_SRV |
|
61 | 1 | ? [$record['target'], $record['port']] |
|
62 | 1 | : [$record['ip'], $this->_port]; |
|
63 | 1 | }, $result)); |
|
64 | } |
||
65 | |||
66 | 1 | return true; |
|
67 | } |
||
68 | } |
||
69 |