Skip to content

Commit de9f03f

Browse files
authored
Update CheckHost.php
1 parent 8d86e24 commit de9f03f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/CheckHost.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ public function setCountry(array|null $countries = null, bool $except = false):
149149
* @return string|false
150150
*/
151151
public function sendRequest(string $host_name, string $check_type, int $max_nodes = 0): string|false {
152+
153+
if (empty($this->nodes)) {
154+
return false;
155+
}
156+
152157
$check_type = strtolower($check_type);
153158
if (!in_array($check_type, ['ping', 'http', 'tcp', 'udp', 'dns', 'traceroute'])) {
154159
return false;
@@ -336,6 +341,10 @@ function getResults(string $request_id): array|false {
336341
* @return array|false
337342
*/
338343
public function runCheck(string $host_name, string $check_type, int $max_nodes = 0): array|false {
344+
if (empty($this->nodes)) {
345+
return false;
346+
}
347+
339348
return $this->getResults($this->sendRequest($host_name, $check_type, $max_nodes));
340349
}
341350

@@ -344,6 +353,11 @@ public function runCheck(string $host_name, string $check_type, int $max_nodes =
344353
* @return array|false
345354
*/
346355
public function fullCheck(string $host_name): array|false {
356+
357+
if (empty($this->nodes)) {
358+
return false;
359+
}
360+
347361
$ping_id = $this->sendRequest($host_name, 'ping');
348362
$http_id = $this->sendRequest($host_name, 'http');
349363
$tcp_id = $this->sendRequest($host_name, 'tcp');

0 commit comments

Comments
 (0)