-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMirrorerOptions.php
124 lines (100 loc) · 2.78 KB
/
MirrorerOptions.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
<?php
namespace Bvarent\FtpSpeculum;
use InvalidArgumentException;
use Zend\Stdlib\AbstractOptions;
/**
* Options for the Mirrorer.
*
* @property string $source_dir E.g. /my/source/dir
* @property string $target_url E.g. ftp://user:[email protected]/path/to/dir
* If the target directory ends with a slash (except the root), the source base name is appended to target directory name.
* @property int $verbose Level 0-3
* @property boolean $cygwin The command will be run in a cygwin environment.
* @property array $options CLI options for the lftp mirror command. E.g. ['reverse' => true, 'include-glob' => '*.zip']
* @property array $settings General settable variables for lftp. E.g. ['net:socket-bind-ipv4' => 'my.ip.add.re'].
*
* @author bvarent <[email protected]>
*/
class MirrorerOptions extends AbstractOptions
{
/**
* The key in the Module config array by which these options can be found in ZF2 config.
* @var string
*/
const MODULE_CONFIG_SUBKEY = 'mirrorer';
/**
* @return array Default values for all options.
*/
public static function defaults()
{
return [
'source_dir' => null,
'target_url' => null,
'cygwin' => false,
'options' => [
'verbose' => 0,
],
'settings' => [],
];
}
protected $sourceDir;
protected function getSourceDir()
{
return $this->sourceDir;
}
protected function setSourceDir($val)
{
if (is_null($val)) {
throw new InvalidArgumentException("Source dir must be specified.");
}
$this->sourceDir = (string)$val;
}
protected $targetUrl;
protected function getTargetUrl()
{
return $this->targetUrl;
}
protected function setTargetUrl($val)
{
if (is_null($val)) {
throw new InvalidArgumentException("Target URL must be specified.");
}
$this->targetUrl = (string)$val;
}
protected $verbose;
protected function getVerbose()
{
return $this->verbose;
}
protected function setVerbose($val)
{
$this->verbose = max(0, (int)$val);
}
protected $cygwin;
protected function getCygwin()
{
return $this->cygwin;
}
protected function setCygwin($val)
{
$this->cygwin = !!$val;
}
protected $options;
protected function getOptions()
{
return $this->options;
}
protected function setOptions(array $val = [])
{
$this->options = $val;
}
protected $settings;
protected function getSettings()
{
return $this->settings;
}
protected function setSettings(array $val = [])
{
$this->settings = $val;
}
}