1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Povils\PHPMND\Console; |
4
|
|
|
|
5
|
|
|
use Povils\PHPMND\Extension\Extension; |
6
|
|
|
use Povils\PHPMND\Language; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @package Povils\PHPMND\Console |
10
|
|
|
*/ |
11
|
|
|
class Option |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var Extension[] |
15
|
|
|
*/ |
16
|
|
|
private $extensions = []; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var array |
20
|
|
|
*/ |
21
|
|
|
private $ignoreNumbers = [0, 0., 1]; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var array |
25
|
|
|
*/ |
26
|
|
|
private $ignoreFuncs = []; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var array |
30
|
|
|
*/ |
31
|
|
|
private $ignoreStrings = ['', '0', '1']; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var bool |
35
|
|
|
*/ |
36
|
|
|
private $includeStrings = false; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var bool |
40
|
|
|
*/ |
41
|
|
|
private $giveHint = false; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var bool |
45
|
|
|
*/ |
46
|
|
|
private $includeNumericStrings = false; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var bool |
50
|
|
|
*/ |
51
|
|
|
private $allowArrayMapping = false; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var array |
55
|
|
|
*/ |
56
|
|
|
private $checkNaming = []; |
57
|
|
|
|
58
|
|
|
public function setExtensions(array $extensions) |
59
|
|
|
{ |
60
|
|
|
$this->extensions = $extensions; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getExtensions(): array |
64
|
|
|
{ |
65
|
|
|
return $this->extensions; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function setIgnoreNumbers(array $ignoreNumbers) |
69
|
|
|
{ |
70
|
|
|
$this->ignoreNumbers = array_merge($this->ignoreNumbers, $ignoreNumbers); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getIgnoreNumbers(): array |
74
|
|
|
{ |
75
|
|
|
return $this->ignoreNumbers; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function setIgnoreFuncs(array $ignoreFuncs) |
79
|
|
|
{ |
80
|
|
|
$this->ignoreFuncs = $ignoreFuncs; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getIgnoreFuncs(): array |
84
|
|
|
{ |
85
|
|
|
return $this->ignoreFuncs; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function includeStrings(): ?bool |
89
|
|
|
{ |
90
|
|
|
return $this->includeStrings; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function setIncludeStrings(?bool $includeStrings) |
94
|
|
|
{ |
95
|
|
|
$this->includeStrings = $includeStrings; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getIgnoreStrings(): array |
99
|
|
|
{ |
100
|
|
|
return $this->ignoreStrings; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function setIgnoreStrings(array $ignoreStrings) |
104
|
|
|
{ |
105
|
|
|
$this->ignoreStrings = array_merge($this->ignoreStrings, $ignoreStrings); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function giveHint(): bool |
109
|
|
|
{ |
110
|
|
|
return $this->giveHint; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function setGiveHint(bool $giveHint) |
114
|
|
|
{ |
115
|
|
|
$this->giveHint = $giveHint; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
public function includeNumericStrings(): ?bool |
119
|
|
|
{ |
120
|
|
|
return $this->includeNumericStrings; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function setIncludeNumericStrings(?bool $includeNumericStrings) |
124
|
|
|
{ |
125
|
|
|
$this->includeNumericStrings = $includeNumericStrings; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function allowArrayMapping(): ?bool |
129
|
|
|
{ |
130
|
|
|
return $this->allowArrayMapping; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
public function setAllowArrayMapping(?bool $allowArrayMapping) |
134
|
|
|
{ |
135
|
|
|
$this->allowArrayMapping = $allowArrayMapping; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return Language[] |
140
|
|
|
*/ |
141
|
|
|
public function checkNaming(): array |
142
|
|
|
{ |
143
|
|
|
return $this->checkNaming; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
public function setCheckNaming(array $checkNaming) |
147
|
|
|
{ |
148
|
|
|
$languages = []; |
149
|
|
|
foreach ($checkNaming as $language) { |
150
|
|
|
$language = ucfirst($language); |
151
|
|
|
$className = '\Povils\PHPMND\Languages\\' . $language; |
152
|
|
|
|
153
|
|
|
if (class_exists($className)) { |
154
|
|
|
$languages[] = new $className(); |
155
|
|
|
} |
156
|
|
|
} |
157
|
|
|
$this->checkNaming = $languages; |
158
|
|
|
} |
159
|
|
|
} |
160
|
|
|
|