We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 706ca1e commit f27e4c8Copy full SHA for f27e4c8
src/PhpseclibV3/SimpleConnectivityChecker.php
@@ -9,12 +9,34 @@
9
10
class SimpleConnectivityChecker implements ConnectivityChecker
11
{
12
+ public function __construct(
13
+ private bool $usePing = false,
14
+ ) {
15
+ }
16
+
17
+ public static function create(): SimpleConnectivityChecker
18
+ {
19
+ return new SimpleConnectivityChecker();
20
21
22
+ public function withUsingPing(bool $usePing): SimpleConnectivityChecker
23
24
+ $clone = clone $this;
25
+ $clone->usePing = $usePing;
26
27
+ return $clone;
28
29
30
public function isConnected(SFTP $connection): bool
31
32
if ( ! $connection->isConnected()) {
33
return false;
34
}
35
36
+ if ( ! $this->usePing) {
37
+ return true;
38
39
40
try {
41
return $connection->ping();
42
} catch (Throwable) {
0 commit comments