Conditions | 4 |
Paths | 4 |
Total Lines | 29 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | public function ping($host) |
||
7 | { |
||
8 | $is_valid_ip = $this->isValidIp($host); |
||
9 | |||
10 | if ($is_valid_ip) { |
||
11 | |||
12 | exec("ping -n 2 $host", $output, $result); |
||
13 | |||
14 | if ($result === 0) { |
||
15 | |||
16 | return true; |
||
17 | |||
18 | } else { |
||
19 | |||
20 | return false; |
||
21 | |||
22 | } |
||
23 | |||
24 | } else { |
||
25 | |||
26 | $result_url = $this->isValidUrl($host); |
||
27 | |||
28 | if ($result_url != $host) { |
||
29 | |||
30 | return true; |
||
31 | |||
32 | } else { |
||
33 | |||
34 | return false; |
||
35 | |||
53 |