1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ParamProcessor; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Object for holding options affecting the behavior of a ParamProcessor object. |
7
|
|
|
* |
8
|
|
|
* @since 1.0 |
9
|
|
|
* |
10
|
|
|
* @licence GNU GPL v2+ |
11
|
|
|
* @author Jeroen De Dauw < [email protected] > |
12
|
|
|
*/ |
13
|
|
|
class Options { |
14
|
|
|
|
15
|
|
|
private $name; |
16
|
|
|
|
17
|
|
|
// During setup |
18
|
|
|
private $unknownInvalid = true; |
19
|
|
|
private $lowercaseNames = true; |
20
|
|
|
private $trimNames = true; |
21
|
|
|
private $acceptOverriding = true; |
22
|
|
|
|
23
|
|
|
// During clean |
24
|
|
|
private $trimValues = true; |
25
|
|
|
private $lowercaseValues = false; |
26
|
|
|
|
27
|
|
|
// During validation |
28
|
|
|
private $rawStringInputs = true; |
29
|
|
|
|
30
|
1 |
|
public function setName( string $name ) { |
31
|
1 |
|
$this->name = $name; |
32
|
1 |
|
} |
33
|
|
|
|
34
|
1 |
|
public function setUnknownInvalid( bool $unknownInvalid ) { |
35
|
1 |
|
$this->unknownInvalid = $unknownInvalid; |
36
|
1 |
|
} |
37
|
|
|
|
38
|
1 |
|
public function setLowercaseNames( bool $lowercase ) { |
39
|
1 |
|
$this->lowercaseNames = $lowercase; |
40
|
1 |
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @deprecated since 1.7 |
44
|
|
|
*/ |
45
|
49 |
|
public function setRawStringInputs( bool $rawInputs ) { |
46
|
49 |
|
$this->rawStringInputs = $rawInputs; |
47
|
49 |
|
} |
48
|
|
|
|
49
|
1 |
|
public function setTrimNames( bool $trim ) { |
50
|
1 |
|
$this->trimNames = $trim; |
51
|
1 |
|
} |
52
|
|
|
|
53
|
1 |
|
public function setTrimValues( bool $trim ) { |
54
|
1 |
|
$this->trimValues = $trim; |
55
|
1 |
|
} |
56
|
|
|
|
57
|
1 |
|
public function setLowercaseValues( bool $lowercase ) { |
58
|
1 |
|
$this->lowercaseValues = $lowercase; |
59
|
1 |
|
} |
60
|
|
|
|
61
|
18 |
|
public function getName(): string { |
62
|
18 |
|
return $this->name ?? ''; |
63
|
|
|
} |
64
|
|
|
|
65
|
46 |
|
public function unknownIsInvalid(): bool { |
66
|
46 |
|
return $this->unknownInvalid; |
67
|
|
|
} |
68
|
|
|
|
69
|
50 |
|
public function lowercaseNames(): bool { |
70
|
50 |
|
return $this->lowercaseNames; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @deprecated since 1.7 |
75
|
|
|
*/ |
76
|
105 |
|
public function isStringlyTyped(): bool { |
77
|
105 |
|
return $this->rawStringInputs; |
78
|
|
|
} |
79
|
|
|
|
80
|
50 |
|
public function trimNames(): bool { |
81
|
50 |
|
return $this->trimNames; |
82
|
|
|
} |
83
|
|
|
|
84
|
106 |
|
public function trimValues(): bool { |
85
|
106 |
|
return $this->trimValues; |
86
|
|
|
} |
87
|
|
|
|
88
|
106 |
|
public function lowercaseValues(): bool { |
89
|
106 |
|
return $this->lowercaseValues; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function acceptOverriding(): bool { |
93
|
|
|
return $this->acceptOverriding; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
} |
97
|
|
|
|