-
Notifications
You must be signed in to change notification settings - Fork 17
/
FtpConnectionOptions.php
125 lines (105 loc) · 2.89 KB
/
FtpConnectionOptions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
declare(strict_types=1);
namespace League\Flysystem\Ftp;
use const FTP_BINARY;
class FtpConnectionOptions
{
public function __construct(
private string $host,
private string $root,
private string $username,
private string $password,
private int $port = 21,
private bool $ssl = false,
private int $timeout = 90,
private bool $utf8 = false,
private bool $passive = true,
private int $transferMode = FTP_BINARY,
private ?string $systemType = null,
private ?bool $ignorePassiveAddress = null,
private bool $enableTimestampsOnUnixListings = false,
private bool $recurseManually = false,
private ?bool $useRawListOptions = null,
) {
}
public function host(): string
{
return $this->host;
}
public function root(): string
{
return $this->root;
}
public function username(): string
{
return $this->username;
}
public function password(): string
{
return $this->password;
}
public function port(): int
{
return $this->port;
}
public function ssl(): bool
{
return $this->ssl;
}
public function timeout(): int
{
return $this->timeout;
}
public function utf8(): bool
{
return $this->utf8;
}
public function passive(): bool
{
return $this->passive;
}
public function transferMode(): int
{
return $this->transferMode;
}
public function systemType(): ?string
{
return $this->systemType;
}
public function ignorePassiveAddress(): ?bool
{
return $this->ignorePassiveAddress;
}
public function timestampsOnUnixListingsEnabled(): bool
{
return $this->enableTimestampsOnUnixListings;
}
public function recurseManually(): bool
{
return $this->recurseManually;
}
public function useRawListOptions(): ?bool
{
return $this->useRawListOptions;
}
public static function fromArray(array $options): FtpConnectionOptions
{
return new FtpConnectionOptions(
$options['host'] ?? 'invalid://host-not-set',
$options['root'] ?? '',
$options['username'] ?? 'invalid://username-not-set',
$options['password'] ?? 'invalid://password-not-set',
$options['port'] ?? 21,
$options['ssl'] ?? false,
$options['timeout'] ?? 90,
$options['utf8'] ?? false,
$options['passive'] ?? true,
$options['transferMode'] ?? FTP_BINARY,
$options['systemType'] ?? null,
$options['ignorePassiveAddress'] ?? null,
$options['timestampsOnUnixListingsEnabled'] ?? false,
$options['recurseManually'] ?? true,
$options['useRawListOptions'] ?? null,
);
}
}