@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class Mailcode_Factory_Instantiator |
22 | 22 | { |
23 | - public function buildIf(string $ifType, string $params, string $type='') : Mailcode_Commands_IfBase |
|
23 | + public function buildIf(string $ifType, string $params, string $type = '') : Mailcode_Commands_IfBase |
|
24 | 24 | { |
25 | 25 | $stringType = $type; |
26 | 26 | |
27 | - if(!empty($type)) |
|
27 | + if (!empty($type)) |
|
28 | 28 | { |
29 | 29 | $stringType = ' '.$type; |
30 | 30 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $this->checkCommand($command); |
45 | 45 | |
46 | - if($command instanceof Mailcode_Commands_IfBase) |
|
46 | + if ($command instanceof Mailcode_Commands_IfBase) |
|
47 | 47 | { |
48 | 48 | return $command; |
49 | 49 | } |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | throw $this->exceptionUnexpectedType('IfBase', $command); |
52 | 52 | } |
53 | 53 | |
54 | - public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_IfBase |
|
54 | + public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_IfBase |
|
55 | 55 | { |
56 | - if($quoteValue) |
|
56 | + if ($quoteValue) |
|
57 | 57 | { |
58 | 58 | $value = $this->quoteString($value); |
59 | 59 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @return Mailcode_Commands_IfBase |
89 | 89 | * @throws Mailcode_Factory_Exception |
90 | 90 | */ |
91 | - public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false, string $containsType='contains') : Mailcode_Commands_IfBase |
|
91 | + public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false, string $containsType = 'contains') : Mailcode_Commands_IfBase |
|
92 | 92 | { |
93 | 93 | $condition = sprintf( |
94 | 94 | '%s%s"%s"', |
@@ -100,23 +100,23 @@ discard block |
||
100 | 100 | return $this->buildIf($ifType, $condition, $containsType); |
101 | 101 | } |
102 | 102 | |
103 | - private function renderListKeywords(bool $caseInsensitive=false, bool $regexEnabled=false) : string |
|
103 | + private function renderListKeywords(bool $caseInsensitive = false, bool $regexEnabled = false) : string |
|
104 | 104 | { |
105 | 105 | $keywords = array(); |
106 | 106 | |
107 | - if($caseInsensitive) |
|
107 | + if ($caseInsensitive) |
|
108 | 108 | { |
109 | 109 | $keywords[] = Mailcode_Commands_Keywords::TYPE_INSENSITIVE; |
110 | 110 | } |
111 | 111 | |
112 | - if($regexEnabled) |
|
112 | + if ($regexEnabled) |
|
113 | 113 | { |
114 | 114 | $keywords[] = Mailcode_Commands_Keywords::TYPE_REGEX; |
115 | 115 | } |
116 | 116 | |
117 | 117 | $keywordsString = ''; |
118 | 118 | |
119 | - if(!empty($keywords)) |
|
119 | + if (!empty($keywords)) |
|
120 | 120 | { |
121 | 121 | $keywordsString = ' '.implode(' ', $keywords); |
122 | 122 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @return Mailcode_Commands_IfBase |
134 | 134 | * @throws Mailcode_Factory_Exception |
135 | 135 | */ |
136 | - public function buildIfNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_IfBase |
|
136 | + public function buildIfNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_IfBase |
|
137 | 137 | { |
138 | 138 | return $this->buildIfContains($ifType, $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'not-contains'); |
139 | 139 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return Mailcode_Commands_IfBase |
149 | 149 | * @throws Mailcode_Factory_Exception |
150 | 150 | */ |
151 | - public function buildIfListContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false, string $containsType='list-contains') : Mailcode_Commands_IfBase |
|
151 | + public function buildIfListContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false, string $containsType = 'list-contains') : Mailcode_Commands_IfBase |
|
152 | 152 | { |
153 | 153 | return $this->buildIfContains($ifType, $variable, $searchTerms, $caseInsensitive, $regexEnabled, $containsType); |
154 | 154 | } |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | * @return Mailcode_Commands_IfBase |
163 | 163 | * @throws Mailcode_Factory_Exception |
164 | 164 | */ |
165 | - public function buildIfListNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_IfBase |
|
165 | + public function buildIfListNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_IfBase |
|
166 | 166 | { |
167 | 167 | return $this->buildIfContains($ifType, $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-not-contains'); |
168 | 168 | } |
169 | 169 | |
170 | - public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
170 | + public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
171 | 171 | { |
172 | 172 | return $this->buildIfSearch($ifType, 'begins-with', $variable, $search, $caseInsensitive); |
173 | 173 | } |
174 | 174 | |
175 | - public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
175 | + public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
176 | 176 | { |
177 | 177 | return $this->buildIfSearch($ifType, 'ends-with', $variable, $search, $caseInsensitive); |
178 | 178 | } |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | ); |
223 | 223 | } |
224 | 224 | |
225 | - private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
225 | + private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
226 | 226 | { |
227 | 227 | $keyword = ' '; |
228 | 228 | |
229 | - if($caseInsensitive) |
|
229 | + if ($caseInsensitive) |
|
230 | 230 | { |
231 | 231 | $keyword = ' '.Mailcode_Commands_Keywords::TYPE_INSENSITIVE; |
232 | 232 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | public function checkCommand(Mailcode_Commands_Command $command) : void |
257 | 257 | { |
258 | - if($command->isValid()) |
|
258 | + if ($command->isValid()) |
|
259 | 259 | { |
260 | 260 | return; |
261 | 261 | } |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class Mailcode_Factory_CommandSets_Set_ElseIf extends Mailcode_Factory_CommandSets_IfBase |
22 | 22 | { |
23 | - public function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf |
|
23 | + public function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf |
|
24 | 24 | { |
25 | 25 | $command = $this->instantiator->buildIf('ElseIf', $condition, $type); |
26 | 26 | |
27 | - if($command instanceof Mailcode_Commands_Command_ElseIf) |
|
27 | + if ($command instanceof Mailcode_Commands_Command_ElseIf) |
|
28 | 28 | { |
29 | 29 | return $command; |
30 | 30 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | throw $this->instantiator->exceptionUnexpectedType('ElseIf', $command); |
33 | 33 | } |
34 | 34 | |
35 | - public function var(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
35 | + public function var(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
36 | 36 | { |
37 | 37 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, $operand, $value, $quoteValue); |
38 | 38 | |
39 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
39 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
40 | 40 | { |
41 | 41 | return $command; |
42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, $operand, $value, true); |
50 | 50 | |
51 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
51 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
52 | 52 | { |
53 | 53 | return $command; |
54 | 54 | } |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarString', $command); |
57 | 57 | } |
58 | 58 | |
59 | - public function varEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
59 | + public function varEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
60 | 60 | { |
61 | 61 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '==', $value, $quoteValue); |
62 | 62 | |
63 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
63 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
64 | 64 | { |
65 | 65 | return $command; |
66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | { |
73 | 73 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '==', $value, true); |
74 | 74 | |
75 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
75 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
76 | 76 | { |
77 | 77 | return $command; |
78 | 78 | } |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarEqualsString', $command); |
81 | 81 | } |
82 | 82 | |
83 | - public function varNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
83 | + public function varNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
84 | 84 | { |
85 | 85 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '!=', $value, $quoteValue); |
86 | 86 | |
87 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
87 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
88 | 88 | { |
89 | 89 | return $command; |
90 | 90 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '!=', $value, true); |
98 | 98 | |
99 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
99 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
100 | 100 | { |
101 | 101 | return $command; |
102 | 102 | } |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | * @return Mailcode_Commands_Command_ElseIf_Contains |
112 | 112 | * @throws Mailcode_Factory_Exception |
113 | 113 | */ |
114 | - public function contains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
|
114 | + public function contains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains |
|
115 | 115 | { |
116 | 116 | $command = $this->instantiator->buildIfContains('ElseIf', $variable, $searchTerms, $caseInsensitive); |
117 | 117 | |
118 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Contains) |
|
118 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Contains) |
|
119 | 119 | { |
120 | 120 | return $command; |
121 | 121 | } |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | * @return Mailcode_Commands_Command_ElseIf_NotContains |
131 | 131 | * @throws Mailcode_Factory_Exception |
132 | 132 | */ |
133 | - public function notContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_NotContains |
|
133 | + public function notContains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_NotContains |
|
134 | 134 | { |
135 | 135 | $command = $this->instantiator->buildIfNotContains('ElseIf', $variable, $searchTerms, $caseInsensitive); |
136 | 136 | |
137 | - if($command instanceof Mailcode_Commands_Command_ElseIf_NotContains) |
|
137 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_NotContains) |
|
138 | 138 | { |
139 | 139 | return $command; |
140 | 140 | } |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | * @return Mailcode_Commands_Command_ElseIf_ListContains |
151 | 151 | * @throws Mailcode_Factory_Exception |
152 | 152 | */ |
153 | - public function listContains(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_ElseIf_ListContains |
|
153 | + public function listContains(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_ElseIf_ListContains |
|
154 | 154 | { |
155 | 155 | $command = $this->instantiator->buildIfListContains('ElseIf', $variable, $searchTerms, $caseInsensitive, $regexEnabled); |
156 | 156 | |
157 | - if($command instanceof Mailcode_Commands_Command_ElseIf_ListContains) |
|
157 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_ListContains) |
|
158 | 158 | { |
159 | 159 | return $command; |
160 | 160 | } |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * @return Mailcode_Commands_Command_ElseIf_ListNotContains |
170 | 170 | * @throws Mailcode_Factory_Exception |
171 | 171 | */ |
172 | - public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_ListNotContains |
|
172 | + public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_ListNotContains |
|
173 | 173 | { |
174 | 174 | $command = $this->instantiator->buildIfListNotContains('ElseIf', $variable, $searchTerms, $caseInsensitive); |
175 | 175 | |
176 | - if($command instanceof Mailcode_Commands_Command_ElseIf_ListNotContains) |
|
176 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_ListNotContains) |
|
177 | 177 | { |
178 | 178 | return $command; |
179 | 179 | } |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | * @return Mailcode_Commands_Command_ElseIf_ListBeginsWith |
190 | 190 | * @throws Mailcode_Factory_Exception |
191 | 191 | */ |
192 | - public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_ElseIf_ListBeginsWith |
|
192 | + public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_ElseIf_ListBeginsWith |
|
193 | 193 | { |
194 | 194 | $command = $this->instantiator->buildIfListContains('ElseIf', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-begins-with'); |
195 | 195 | |
196 | - if($command instanceof Mailcode_Commands_Command_ElseIf_ListBeginsWith) |
|
196 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_ListBeginsWith) |
|
197 | 197 | { |
198 | 198 | return $command; |
199 | 199 | } |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | * @return Mailcode_Commands_Command_ElseIf_ListEndsWith |
210 | 210 | * @throws Mailcode_Factory_Exception |
211 | 211 | */ |
212 | - public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_ElseIf_ListEndsWith |
|
212 | + public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_ElseIf_ListEndsWith |
|
213 | 213 | { |
214 | 214 | $command = $this->instantiator->buildIfListContains('ElseIf', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-ends-with'); |
215 | 215 | |
216 | - if($command instanceof Mailcode_Commands_Command_ElseIf_ListEndsWith) |
|
216 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_ListEndsWith) |
|
217 | 217 | { |
218 | 218 | return $command; |
219 | 219 | } |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | throw $this->instantiator->exceptionUnexpectedType('ElseIfListEndsWith', $command); |
222 | 222 | } |
223 | 223 | |
224 | - public function beginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
224 | + public function beginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
225 | 225 | { |
226 | 226 | $command = $this->instantiator->buildIfBeginsWith('ElseIf', $variable, $search, $caseInsensitive); |
227 | 227 | |
228 | - if($command instanceof Mailcode_Commands_Command_ElseIf_BeginsWith) |
|
228 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_BeginsWith) |
|
229 | 229 | { |
230 | 230 | return $command; |
231 | 231 | } |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | throw $this->instantiator->exceptionUnexpectedType('ElseIfBeginsWith', $command); |
234 | 234 | } |
235 | 235 | |
236 | - public function endsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
236 | + public function endsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
237 | 237 | { |
238 | 238 | $command = $this->instantiator->buildIfEndsWith('ElseIf', $variable, $search, $caseInsensitive); |
239 | 239 | |
240 | - if($command instanceof Mailcode_Commands_Command_ElseIf_EndsWith) |
|
240 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_EndsWith) |
|
241 | 241 | { |
242 | 242 | return $command; |
243 | 243 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | { |
250 | 250 | $command = $this->instantiator->buildIfEmpty('ElseIf', $variable); |
251 | 251 | |
252 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Empty) |
|
252 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Empty) |
|
253 | 253 | { |
254 | 254 | return $command; |
255 | 255 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | { |
262 | 262 | $command = $this->instantiator->buildIfNotEmpty('ElseIf', $variable); |
263 | 263 | |
264 | - if($command instanceof Mailcode_Commands_Command_ElseIf_NotEmpty) |
|
264 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_NotEmpty) |
|
265 | 265 | { |
266 | 266 | return $command; |
267 | 267 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | { |
274 | 274 | $command = $this->instantiator->buildIfBiggerThan('ElseIf', $variable, $value); |
275 | 275 | |
276 | - if($command instanceof Mailcode_Commands_Command_ElseIf_BiggerThan) |
|
276 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_BiggerThan) |
|
277 | 277 | { |
278 | 278 | return $command; |
279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | { |
286 | 286 | $command = $this->instantiator->buildIfSmallerThan('ElseIf', $variable, $value); |
287 | 287 | |
288 | - if($command instanceof Mailcode_Commands_Command_ElseIf_SmallerThan) |
|
288 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_SmallerThan) |
|
289 | 289 | { |
290 | 290 | return $command; |
291 | 291 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | { |
298 | 298 | $command = $this->instantiator->buildIfEquals('ElseIf', $variable, $value); |
299 | 299 | |
300 | - if($command instanceof Mailcode_Commands_Command_ElseIf_EqualsNumber) |
|
300 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_EqualsNumber) |
|
301 | 301 | { |
302 | 302 | return $command; |
303 | 303 | } |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class Mailcode_Factory_CommandSets_Set_If extends Mailcode_Factory_CommandSets_IfBase |
22 | 22 | { |
23 | - public function if(string $condition, string $type='') : Mailcode_Commands_Command_If |
|
23 | + public function if (string $condition, string $type = '') : Mailcode_Commands_Command_If |
|
24 | 24 | { |
25 | 25 | $command = $this->instantiator->buildIf('If', $condition, $type); |
26 | 26 | |
27 | - if($command instanceof Mailcode_Commands_Command_If) |
|
27 | + if ($command instanceof Mailcode_Commands_Command_If) |
|
28 | 28 | { |
29 | 29 | return $command; |
30 | 30 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | throw $this->instantiator->exceptionUnexpectedType('If', $command); |
33 | 33 | } |
34 | 34 | |
35 | - public function var(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
35 | + public function var(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
36 | 36 | { |
37 | 37 | $command = $this->instantiator->buildIfVar('If', $variable, $operand, $value, $quoteValue); |
38 | 38 | |
39 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
39 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
40 | 40 | { |
41 | 41 | return $command; |
42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $command = $this->instantiator->buildIfVar('If', $variable, $operand, $value, true); |
50 | 50 | |
51 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
51 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
52 | 52 | { |
53 | 53 | return $command; |
54 | 54 | } |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | throw $this->instantiator->exceptionUnexpectedType('IfVarString', $command); |
57 | 57 | } |
58 | 58 | |
59 | - public function varEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
59 | + public function varEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
60 | 60 | { |
61 | 61 | $command = $this->instantiator->buildIfVar('If', $variable, '==', $value, $quoteValue); |
62 | 62 | |
63 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
63 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
64 | 64 | { |
65 | 65 | return $command; |
66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | { |
73 | 73 | $command = $this->instantiator->buildIfVar('If', $variable, '==', $value, true); |
74 | 74 | |
75 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
75 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
76 | 76 | { |
77 | 77 | return $command; |
78 | 78 | } |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | throw $this->instantiator->exceptionUnexpectedType('IfarEqualsString', $command); |
81 | 81 | } |
82 | 82 | |
83 | - public function varNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
83 | + public function varNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
84 | 84 | { |
85 | 85 | $command = $this->instantiator->buildIfVar('If', $variable, '!=', $value, $quoteValue); |
86 | 86 | |
87 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
87 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
88 | 88 | { |
89 | 89 | return $command; |
90 | 90 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | $command = $this->instantiator->buildIfVar('If', $variable, '!=', $value, true); |
98 | 98 | |
99 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
99 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
100 | 100 | { |
101 | 101 | return $command; |
102 | 102 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | $command = $this->instantiator->buildIfEmpty('If', $variable); |
110 | 110 | |
111 | - if($command instanceof Mailcode_Commands_Command_If_Empty) |
|
111 | + if ($command instanceof Mailcode_Commands_Command_If_Empty) |
|
112 | 112 | { |
113 | 113 | return $command; |
114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | $command = $this->instantiator->buildIfNotEmpty('If', $variable); |
122 | 122 | |
123 | - if($command instanceof Mailcode_Commands_Command_If_NotEmpty) |
|
123 | + if ($command instanceof Mailcode_Commands_Command_If_NotEmpty) |
|
124 | 124 | { |
125 | 125 | return $command; |
126 | 126 | } |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | * @return Mailcode_Commands_Command_If_Contains |
136 | 136 | * @throws Mailcode_Factory_Exception |
137 | 137 | */ |
138 | - public function contains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
|
138 | + public function contains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains |
|
139 | 139 | { |
140 | 140 | $command = $this->instantiator->buildIfContains('If', $variable, $searchTerms, $caseInsensitive); |
141 | 141 | |
142 | - if($command instanceof Mailcode_Commands_Command_If_Contains) |
|
142 | + if ($command instanceof Mailcode_Commands_Command_If_Contains) |
|
143 | 143 | { |
144 | 144 | return $command; |
145 | 145 | } |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | * @return Mailcode_Commands_Command_If_NotContains |
155 | 155 | * @throws Mailcode_Factory_Exception |
156 | 156 | */ |
157 | - public function notContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_NotContains |
|
157 | + public function notContains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_NotContains |
|
158 | 158 | { |
159 | 159 | $command = $this->instantiator->buildIfNotContains('If', $variable, $searchTerms, $caseInsensitive); |
160 | 160 | |
161 | - if($command instanceof Mailcode_Commands_Command_If_NotContains) |
|
161 | + if ($command instanceof Mailcode_Commands_Command_If_NotContains) |
|
162 | 162 | { |
163 | 163 | return $command; |
164 | 164 | } |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | * @return Mailcode_Commands_Command_If_ListContains |
175 | 175 | * @throws Mailcode_Factory_Exception |
176 | 176 | */ |
177 | - public function listContains(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListContains |
|
177 | + public function listContains(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListContains |
|
178 | 178 | { |
179 | 179 | $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-contains'); |
180 | 180 | |
181 | - if($command instanceof Mailcode_Commands_Command_If_ListContains) |
|
181 | + if ($command instanceof Mailcode_Commands_Command_If_ListContains) |
|
182 | 182 | { |
183 | 183 | return $command; |
184 | 184 | } |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | * @return Mailcode_Commands_Command_If_ListNotContains |
194 | 194 | * @throws Mailcode_Factory_Exception |
195 | 195 | */ |
196 | - public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_ListNotContains |
|
196 | + public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_ListNotContains |
|
197 | 197 | { |
198 | 198 | $command = $this->instantiator->buildIfListNotContains('If', $variable, $searchTerms, $caseInsensitive); |
199 | 199 | |
200 | - if($command instanceof Mailcode_Commands_Command_If_ListNotContains) |
|
200 | + if ($command instanceof Mailcode_Commands_Command_If_ListNotContains) |
|
201 | 201 | { |
202 | 202 | return $command; |
203 | 203 | } |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | * @return Mailcode_Commands_Command_If_ListBeginsWith |
214 | 214 | * @throws Mailcode_Factory_Exception |
215 | 215 | */ |
216 | - public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListBeginsWith |
|
216 | + public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListBeginsWith |
|
217 | 217 | { |
218 | - $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled,'list-begins-with'); |
|
218 | + $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-begins-with'); |
|
219 | 219 | |
220 | - if($command instanceof Mailcode_Commands_Command_If_ListBeginsWith) |
|
220 | + if ($command instanceof Mailcode_Commands_Command_If_ListBeginsWith) |
|
221 | 221 | { |
222 | 222 | return $command; |
223 | 223 | } |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | * @return Mailcode_Commands_Command_If_ListEndsWith |
234 | 234 | * @throws Mailcode_Factory_Exception |
235 | 235 | */ |
236 | - public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListEndsWith |
|
236 | + public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListEndsWith |
|
237 | 237 | { |
238 | - $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled,'list-ends-with'); |
|
238 | + $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-ends-with'); |
|
239 | 239 | |
240 | - if($command instanceof Mailcode_Commands_Command_If_ListEndsWith) |
|
240 | + if ($command instanceof Mailcode_Commands_Command_If_ListEndsWith) |
|
241 | 241 | { |
242 | 242 | return $command; |
243 | 243 | } |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | throw $this->instantiator->exceptionUnexpectedType('IfListEndsWith', $command); |
246 | 246 | } |
247 | 247 | |
248 | - public function beginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_BeginsWith |
|
248 | + public function beginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_BeginsWith |
|
249 | 249 | { |
250 | 250 | $command = $this->instantiator->buildIfBeginsWith('If', $variable, $search, $caseInsensitive); |
251 | 251 | |
252 | - if($command instanceof Mailcode_Commands_Command_If_BeginsWith) |
|
252 | + if ($command instanceof Mailcode_Commands_Command_If_BeginsWith) |
|
253 | 253 | { |
254 | 254 | return $command; |
255 | 255 | } |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | throw $this->instantiator->exceptionUnexpectedType('IfBeginsWith', $command); |
258 | 258 | } |
259 | 259 | |
260 | - public function endsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_EndsWith |
|
260 | + public function endsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_EndsWith |
|
261 | 261 | { |
262 | 262 | $command = $this->instantiator->buildIfEndsWith('If', $variable, $search, $caseInsensitive); |
263 | 263 | |
264 | - if($command instanceof Mailcode_Commands_Command_If_EndsWith) |
|
264 | + if ($command instanceof Mailcode_Commands_Command_If_EndsWith) |
|
265 | 265 | { |
266 | 266 | return $command; |
267 | 267 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | { |
274 | 274 | $command = $this->instantiator->buildIfBiggerThan('If', $variable, $value); |
275 | 275 | |
276 | - if($command instanceof Mailcode_Commands_Command_If_BiggerThan) |
|
276 | + if ($command instanceof Mailcode_Commands_Command_If_BiggerThan) |
|
277 | 277 | { |
278 | 278 | return $command; |
279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | { |
286 | 286 | $command = $this->instantiator->buildIfSmallerThan('If', $variable, $value); |
287 | 287 | |
288 | - if($command instanceof Mailcode_Commands_Command_If_SmallerThan) |
|
288 | + if ($command instanceof Mailcode_Commands_Command_If_SmallerThan) |
|
289 | 289 | { |
290 | 290 | return $command; |
291 | 291 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | { |
298 | 298 | $command = $this->instantiator->buildIfEquals('If', $variable, $value); |
299 | 299 | |
300 | - if($command instanceof Mailcode_Commands_Command_If_EqualsNumber) |
|
300 | + if ($command instanceof Mailcode_Commands_Command_If_EqualsNumber) |
|
301 | 301 | { |
302 | 302 | return $command; |
303 | 303 | } |
@@ -26,14 +26,14 @@ |
||
26 | 26 | */ |
27 | 27 | trait Mailcode_Traits_Commands_Validation_CaseSensitive |
28 | 28 | { |
29 | - /** |
|
30 | - * @var boolean |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var boolean |
|
31 | + */ |
|
32 | 32 | protected $caseInsensitive = false; |
33 | 33 | |
34 | - /** |
|
35 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
36 | + */ |
|
37 | 37 | protected $regexToken; |
38 | 38 | |
39 | 39 | protected function validateSyntax_case_sensitive() : void |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $this->caseInsensitive = $val->isValid(); |
44 | 44 | |
45 | - if($val->isValid()) |
|
45 | + if ($val->isValid()) |
|
46 | 46 | { |
47 | 47 | $this->regexToken = $val->getToken(); |
48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function getCaseToken() : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
57 | 57 | { |
58 | - if($this->regexToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
58 | + if ($this->regexToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
59 | 59 | { |
60 | 60 | return $this->regexToken; |
61 | 61 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $this->regexEnabled = $val->isValid(); |
44 | 44 | |
45 | - if($val->isValid()) |
|
45 | + if ($val->isValid()) |
|
46 | 46 | { |
47 | 47 | $this->regexToken = $val->getToken(); |
48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function getRegexToken() : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
57 | 57 | { |
58 | - if($this->regexToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
58 | + if ($this->regexToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
59 | 59 | { |
60 | 60 | return $this->regexToken; |
61 | 61 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | */ |
29 | 29 | class Mailcode_Parser_Statement_Validator |
30 | 30 | { |
31 | - /** |
|
32 | - * @var Mailcode_Parser_Statement |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var Mailcode_Parser_Statement |
|
33 | + */ |
|
34 | 34 | private $statement; |
35 | 35 | |
36 | 36 | public function __construct(Mailcode_Parser_Statement $statement) |
@@ -38,24 +38,24 @@ discard block |
||
38 | 38 | $this->statement = $statement; |
39 | 39 | } |
40 | 40 | |
41 | - /** |
|
42 | - * Creates a variable validator: checks whether a single |
|
43 | - * variable token is present in the parameters. |
|
44 | - * |
|
45 | - * @return Mailcode_Parser_Statement_Validator_Type_Variable |
|
46 | - */ |
|
41 | + /** |
|
42 | + * Creates a variable validator: checks whether a single |
|
43 | + * variable token is present in the parameters. |
|
44 | + * |
|
45 | + * @return Mailcode_Parser_Statement_Validator_Type_Variable |
|
46 | + */ |
|
47 | 47 | public function createVariable() : Mailcode_Parser_Statement_Validator_Type_Variable |
48 | 48 | { |
49 | 49 | return new Mailcode_Parser_Statement_Validator_Type_Variable($this->statement); |
50 | 50 | } |
51 | 51 | |
52 | - /** |
|
53 | - * Creates a keyword validator: checks whether a single |
|
54 | - * keyword token is present in the parameters. |
|
55 | - * |
|
56 | - * @param string $keywordName |
|
57 | - * @return Mailcode_Parser_Statement_Validator_Type_Keyword |
|
58 | - */ |
|
52 | + /** |
|
53 | + * Creates a keyword validator: checks whether a single |
|
54 | + * keyword token is present in the parameters. |
|
55 | + * |
|
56 | + * @param string $keywordName |
|
57 | + * @return Mailcode_Parser_Statement_Validator_Type_Keyword |
|
58 | + */ |
|
59 | 59 | public function createKeyword(string $keywordName) : Mailcode_Parser_Statement_Validator_Type_Keyword |
60 | 60 | { |
61 | 61 | return new Mailcode_Parser_Statement_Validator_Type_Keyword( |
@@ -74,11 +74,11 @@ |
||
74 | 74 | return new Mailcode_Parser_Statement_Validator_Type_Value($this->statement); |
75 | 75 | } |
76 | 76 | |
77 | - public function createOperand(string $sign='') : Mailcode_Parser_Statement_Validator_Type_Operand |
|
77 | + public function createOperand(string $sign = '') : Mailcode_Parser_Statement_Validator_Type_Operand |
|
78 | 78 | { |
79 | 79 | $validate = new Mailcode_Parser_Statement_Validator_Type_Operand($this->statement); |
80 | 80 | |
81 | - if(!empty($sign)) |
|
81 | + if (!empty($sign)) |
|
82 | 82 | { |
83 | 83 | $validate->setOperandSign($sign); |
84 | 84 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function getSign() : string |
86 | 86 | { |
87 | - if($this->isNotContains()) |
|
87 | + if ($this->isNotContains()) |
|
88 | 88 | { |
89 | 89 | return '!'; |
90 | 90 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getConnector() |
103 | 103 | { |
104 | - if($this->isNotContains()) |
|
104 | + if ($this->isNotContains()) |
|
105 | 105 | { |
106 | 106 | return '&&'; |
107 | 107 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | { |
118 | 118 | $parts = array(); |
119 | 119 | |
120 | - foreach($this->searchTerms as $token) |
|
120 | + foreach ($this->searchTerms as $token) |
|
121 | 121 | { |
122 | 122 | $parts[] = $this->renderCommand($token); |
123 | 123 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | private function renderCommand(Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral $searchTerm) : string |
134 | 134 | { |
135 | - if($this->isList()) |
|
135 | + if ($this->isList()) |
|
136 | 136 | { |
137 | 137 | $command = $this->renderListCommand($searchTerm); |
138 | 138 | } |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | private function renderRegex(Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral $searchTerm) : string |
174 | 174 | { |
175 | 175 | $opts = 's'; |
176 | - if($this->caseSensitive) |
|
176 | + if ($this->caseSensitive) |
|
177 | 177 | { |
178 | 178 | $opts = 'is'; |
179 | 179 | } |
180 | 180 | |
181 | 181 | $filtered = trim($searchTerm->getNormalized(), '"'); |
182 | 182 | |
183 | - if(!$this->regexEnabled) |
|
183 | + if (!$this->regexEnabled) |
|
184 | 184 | { |
185 | 185 | $filtered = $this->translator->filterRegexString($filtered); |
186 | 186 | $filtered = $this->addWildcards($filtered); |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | */ |
204 | 204 | private function addWildcards(string $searchTerm) : string |
205 | 205 | { |
206 | - if($this->containsType === 'list-begins-with') |
|
206 | + if ($this->containsType === 'list-begins-with') |
|
207 | 207 | { |
208 | 208 | return '.*'.$searchTerm; |
209 | 209 | } |
210 | 210 | |
211 | - if($this->containsType === 'list-ends-with') |
|
211 | + if ($this->containsType === 'list-ends-with') |
|
212 | 212 | { |
213 | 213 | return $searchTerm.'.*'; |
214 | 214 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | { |
225 | 225 | $tokens = explode('.', ltrim($this->variable->getFullName(), '$')); |
226 | 226 | |
227 | - if(count($tokens) === 2) |
|
227 | + if (count($tokens) === 2) |
|
228 | 228 | { |
229 | 229 | return array( |
230 | 230 | 'path' => $tokens[0], |