Conditions | 8 |
Paths | 13 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | protected function dnsResolutionIsOk($domain = null, $ip = null) |
||
20 | { |
||
21 | if ($this->dnsAlreadyResolved) { |
||
|
|||
22 | return true; |
||
23 | } |
||
24 | |||
25 | $domain = $domain ? $domain: $this->obtainDomain(); |
||
26 | $ip = $ip ? $ip: $this->obtainIp(); |
||
27 | |||
28 | if ($domain != null && $ip != null) { |
||
29 | $resolved_ip = gethostbyname($domain); |
||
30 | if ($resolved_ip != $domain && $resolved_ip == $ip) { |
||
31 | $this->dnsAlreadyResolved = true; |
||
32 | return true; |
||
33 | } |
||
34 | } |
||
35 | return false; |
||
36 | } |
||
37 | |||
58 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: