1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* File containing the {@see Mailcode_Commands_IfBase} class. |
4
|
|
|
* |
5
|
|
|
* @package Mailcode |
6
|
|
|
* @subpackage Commands |
7
|
|
|
* @see Mailcode_Commands_IfBase |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
declare(strict_types=1); |
11
|
|
|
|
12
|
|
|
namespace Mailcode; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Abstract base class for IF commands (IF, ELSEIF). |
16
|
|
|
* |
17
|
|
|
* @package Mailcode |
18
|
|
|
* @subpackage Commands |
19
|
|
|
* @author Sebastian Mordziol <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
abstract class Mailcode_Commands_IfBase extends Mailcode_Commands_Command |
22
|
|
|
{ |
23
|
|
|
const VALIDATION_VARIABLE_MISSING = 49201; |
24
|
|
|
|
25
|
|
|
const VALIDATION_CONTAINS_MISSING_SEARCH_TERM = 49202; |
26
|
|
|
|
27
|
|
|
const VALIDATION_INVALID_KEYWORD = 49203; |
28
|
|
|
|
29
|
|
|
const VALIDATION_OPERAND_MISSING = 49204; |
30
|
|
|
|
31
|
|
|
const VALIDATION_OPERAND_NOT_COMPARISON = 49205; |
32
|
|
|
|
33
|
|
|
const VALIDATION_INVALID_COMPARISON_TOKEN = 49206; |
34
|
|
|
|
35
|
|
|
const VALIDATION_EXPECTED_KEYWORD = 49207; |
36
|
|
|
|
37
|
|
|
const VALIDATION_NOTHING_AFTER_OPERAND = 49208; |
38
|
|
|
|
39
|
|
|
const ERROR_NO_VARIABLE_AVAILABLE = 52601; |
40
|
|
|
|
41
|
|
|
const ERROR_NO_STRING_LITERAL_AVAILABLE = 52602; |
42
|
|
|
|
43
|
|
|
const ERROR_NO_COMPARATOR_AVAILABLE = 52603; |
44
|
|
|
|
45
|
|
|
public function supportsType(): bool |
46
|
|
|
{ |
47
|
|
|
return true; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function requiresParameters(): bool |
51
|
|
|
{ |
52
|
|
|
return true; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function isCommand() : bool |
56
|
|
|
{ |
57
|
|
|
return $this->type === 'command' || empty($this->type); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function isVariable() : bool |
61
|
|
|
{ |
62
|
|
|
return $this->type === 'variable'; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function isContains() : bool |
66
|
|
|
{ |
67
|
|
|
return $this->type === 'contains'; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
protected function getValidations() : array |
71
|
|
|
{ |
72
|
|
|
return array(); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function generatesContent() : bool |
76
|
|
|
{ |
77
|
|
|
return false; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function getSupportedTypes() : array |
81
|
|
|
{ |
82
|
|
|
return array( |
83
|
|
|
'variable', |
84
|
|
|
'command', |
85
|
|
|
'contains' |
86
|
|
|
); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function getDefaultType() : string |
90
|
|
|
{ |
91
|
|
|
return 'command'; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|