@@ -23,24 +23,24 @@ |
||
23 | 23 | */ |
24 | 24 | class Mailcode_Parser_Match |
25 | 25 | { |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | 29 | protected string $name; |
30 | 30 | |
31 | - /** |
|
32 | - * @var string |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var string |
|
33 | + */ |
|
34 | 34 | protected string $type; |
35 | 35 | |
36 | - /** |
|
37 | - * @var string |
|
38 | - */ |
|
36 | + /** |
|
37 | + * @var string |
|
38 | + */ |
|
39 | 39 | protected string $params; |
40 | 40 | |
41 | - /** |
|
42 | - * @var string |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var string |
|
43 | + */ |
|
44 | 44 | protected string $matchedString; |
45 | 45 | |
46 | 46 | public function __construct(string $name, string $type, string $params, string $matchedString) |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | protected string $matchedText; |
25 | 25 | private ?Mailcode_Commands_Command $sourceCommand; |
26 | 26 | |
27 | - /** |
|
28 | - * @var mixed |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var mixed |
|
29 | + */ |
|
30 | 30 | protected $subject; |
31 | 31 | |
32 | 32 | /** |
@@ -58,20 +58,20 @@ discard block |
||
58 | 58 | return $this->sourceCommand; |
59 | 59 | } |
60 | 60 | |
61 | - /** |
|
62 | - * The ID of the type. i.e. the class name ("Keyword", "StringLiteral"). |
|
63 | - * @return string |
|
64 | - */ |
|
61 | + /** |
|
62 | + * The ID of the type. i.e. the class name ("Keyword", "StringLiteral"). |
|
63 | + * @return string |
|
64 | + */ |
|
65 | 65 | public function getTypeID() : string |
66 | 66 | { |
67 | 67 | $parts = explode('_', get_class($this)); |
68 | 68 | return array_pop($parts); |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
72 | - * Retrieves a unique ID of the token. |
|
73 | - * @return string |
|
74 | - */ |
|
71 | + /** |
|
72 | + * Retrieves a unique ID of the token. |
|
73 | + * @return string |
|
74 | + */ |
|
75 | 75 | public function getID() : string |
76 | 76 | { |
77 | 77 | return $this->tokenID; |
@@ -35,31 +35,31 @@ |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | - * Retrieves the text with the surrounding quotes, |
|
39 | - * and special characters escaped for Mailcode. |
|
40 | - * |
|
41 | - * @return string |
|
42 | - */ |
|
38 | + * Retrieves the text with the surrounding quotes, |
|
39 | + * and special characters escaped for Mailcode. |
|
40 | + * |
|
41 | + * @return string |
|
42 | + */ |
|
43 | 43 | public function getNormalized() : string |
44 | 44 | { |
45 | 45 | return '"'.SpecialChars::escape($this->text).'"'; |
46 | 46 | } |
47 | 47 | |
48 | - /** |
|
49 | - * Retrieves the text with the surrounding quotes. |
|
50 | - * @return string |
|
51 | - */ |
|
48 | + /** |
|
49 | + * Retrieves the text with the surrounding quotes. |
|
50 | + * @return string |
|
51 | + */ |
|
52 | 52 | public function getValue() : string |
53 | 53 | { |
54 | 54 | return $this->getNormalized(); |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * Retrieves the text without the surrounding quotes, |
|
59 | - * and special Mailcode characters not escaped. |
|
60 | - * |
|
61 | - * @return string |
|
62 | - */ |
|
57 | + /** |
|
58 | + * Retrieves the text without the surrounding quotes, |
|
59 | + * and special Mailcode characters not escaped. |
|
60 | + * |
|
61 | + * @return string |
|
62 | + */ |
|
63 | 63 | public function getText() : string |
64 | 64 | { |
65 | 65 | return SpecialChars::decode($this->text); |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | Mailcode_Parser_Statement_Tokenizer_Process_ExtractTokens::class |
42 | 42 | ); |
43 | 43 | |
44 | - /** |
|
45 | - * @var Mailcode_Parser_Statement |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var Mailcode_Parser_Statement |
|
46 | + */ |
|
47 | 47 | protected Mailcode_Parser_Statement $statement; |
48 | 48 | |
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | 52 | protected string $tokenized = ''; |
53 | 53 | |
54 | 54 | /** |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | */ |
57 | 57 | protected array $tokensOrdered = array(); |
58 | 58 | |
59 | - /** |
|
60 | - * @var string[] |
|
61 | - */ |
|
59 | + /** |
|
60 | + * @var string[] |
|
61 | + */ |
|
62 | 62 | protected static array $ids = array(); |
63 | 63 | |
64 | 64 | /** |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | return $this->statement->getSourceCommand(); |
79 | 79 | } |
80 | 80 | |
81 | - /** |
|
82 | - * Retrieves all tokens detected in the statement string, in |
|
83 | - * the order they were found. |
|
84 | - * |
|
85 | - * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
86 | - */ |
|
81 | + /** |
|
82 | + * Retrieves all tokens detected in the statement string, in |
|
83 | + * the order they were found. |
|
84 | + * |
|
85 | + * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
86 | + */ |
|
87 | 87 | public function getTokens() : array |
88 | 88 | { |
89 | 89 | return $this->tokensOrdered; |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | return !empty($this->tokensOrdered); |
95 | 95 | } |
96 | 96 | |
97 | - /** |
|
98 | - * Whether there were any unknown tokens in the statement. |
|
99 | - * |
|
100 | - * @return bool |
|
101 | - */ |
|
97 | + /** |
|
98 | + * Whether there were any unknown tokens in the statement. |
|
99 | + * |
|
100 | + * @return bool |
|
101 | + */ |
|
102 | 102 | public function hasUnknown() : bool |
103 | 103 | { |
104 | 104 | $unknown = $this->getUnknown(); |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | return !empty($unknown); |
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * Retrieves all unknown content tokens, if any. |
|
111 | - * |
|
112 | - * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[] |
|
113 | - */ |
|
109 | + /** |
|
110 | + * Retrieves all unknown content tokens, if any. |
|
111 | + * |
|
112 | + * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[] |
|
113 | + */ |
|
114 | 114 | public function getUnknown() : array |
115 | 115 | { |
116 | 116 | $result = array(); |
@@ -313,13 +313,13 @@ discard block |
||
313 | 313 | return $token; |
314 | 314 | } |
315 | 315 | |
316 | - /** |
|
317 | - * Generates a unique alphabet-based ID without numbers |
|
318 | - * to use as token name, to avoid conflicts with the |
|
319 | - * numbers detection. |
|
320 | - * |
|
321 | - * @return string |
|
322 | - */ |
|
316 | + /** |
|
317 | + * Generates a unique alphabet-based ID without numbers |
|
318 | + * to use as token name, to avoid conflicts with the |
|
319 | + * numbers detection. |
|
320 | + * |
|
321 | + * @return string |
|
322 | + */ |
|
323 | 323 | protected function generateID() : string |
324 | 324 | { |
325 | 325 | static $alphas; |
@@ -20,9 +20,9 @@ |
||
20 | 20 | */ |
21 | 21 | abstract class Mailcode_Factory_CommandSets_Set |
22 | 22 | { |
23 | - /** |
|
24 | - * @var Mailcode_Factory_Instantiator |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var Mailcode_Factory_Instantiator |
|
25 | + */ |
|
26 | 26 | protected Mailcode_Factory_Instantiator $instantiator; |
27 | 27 | |
28 | 28 | /** |
@@ -62,23 +62,23 @@ |
||
62 | 62 | |
63 | 63 | public function getNestedMailcode() : Mailcode_Collection |
64 | 64 | { |
65 | - if(isset($this->nestedMailcode)) |
|
66 | - { |
|
67 | - return $this->nestedMailcode; |
|
68 | - } |
|
69 | - |
|
70 | - if($this->isMailcodeEnabled()) |
|
71 | - { |
|
72 | - $collection = Mailcode::create()->parseString($this->getContent()); |
|
73 | - } |
|
74 | - else |
|
75 | - { |
|
76 | - $collection = new Mailcode_Collection(); |
|
77 | - } |
|
78 | - |
|
79 | - $this->nestedMailcode = $collection; |
|
80 | - |
|
81 | - return $collection; |
|
65 | + if(isset($this->nestedMailcode)) |
|
66 | + { |
|
67 | + return $this->nestedMailcode; |
|
68 | + } |
|
69 | + |
|
70 | + if($this->isMailcodeEnabled()) |
|
71 | + { |
|
72 | + $collection = Mailcode::create()->parseString($this->getContent()); |
|
73 | + } |
|
74 | + else |
|
75 | + { |
|
76 | + $collection = new Mailcode_Collection(); |
|
77 | + } |
|
78 | + |
|
79 | + $this->nestedMailcode = $collection; |
|
80 | + |
|
81 | + return $collection; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | protected function validateSyntax_nested_mailcode() : void |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | use Mailcode_Traits_Commands_Validation_Variable; |
26 | 26 | use Mailcode_Traits_Commands_Validation_CaseSensitive; |
27 | 27 | |
28 | - /** |
|
29 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
30 | + */ |
|
31 | 31 | protected array $searchTerms = array(); |
32 | 32 | |
33 | 33 | protected function getValidations() : array |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - /** |
|
64 | - * Retrieves all search terms. |
|
65 | - * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
66 | - */ |
|
63 | + /** |
|
64 | + * Retrieves all search terms. |
|
65 | + * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
66 | + */ |
|
67 | 67 | public function getSearchTerms() : array |
68 | 68 | { |
69 | 69 | return $this->searchTerms; |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | abstract class Mailcode_Translator_Syntax_ApacheVelocity extends Mailcode_Translator_Command |
24 | 24 | { |
25 | 25 | /** |
26 | - * @var string[] |
|
27 | - */ |
|
26 | + * @var string[] |
|
27 | + */ |
|
28 | 28 | private array $regexSpecialChars = array( |
29 | 29 | '?', |
30 | 30 | '.', |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * Filters the string for use in an Apache Velocity (Java) |
|
53 | - * regex string: escapes all special characters. |
|
54 | - * |
|
55 | - * Velocity does its own escaping, so no need to escape special |
|
56 | - * characters as if they were a javascript string. |
|
57 | - * |
|
58 | - * @param string $string |
|
59 | - * @return string |
|
60 | - */ |
|
52 | + * Filters the string for use in an Apache Velocity (Java) |
|
53 | + * regex string: escapes all special characters. |
|
54 | + * |
|
55 | + * Velocity does its own escaping, so no need to escape special |
|
56 | + * characters as if they were a javascript string. |
|
57 | + * |
|
58 | + * @param string $string |
|
59 | + * @return string |
|
60 | + */ |
|
61 | 61 | public function filterRegexString(string $string) : string |
62 | 62 | { |
63 | 63 | // Special case: previously escaped quotes. |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | public const ERROR_INVALID_DUMMY_COMMAND_TYPE = 45903; |
29 | 29 | public const ERROR_INVALID_COMMAND_CLASS = 45904; |
30 | 30 | |
31 | - /** |
|
32 | - * @var Mailcode_Commands_Command[] |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var Mailcode_Commands_Command[] |
|
33 | + */ |
|
34 | 34 | private array $commands = array(); |
35 | 35 | |
36 | - /** |
|
37 | - * @var array<string,Mailcode_Commands_Command> |
|
38 | - */ |
|
36 | + /** |
|
37 | + * @var array<string,Mailcode_Commands_Command> |
|
38 | + */ |
|
39 | 39 | private static array $dummyCommands = array(); |
40 | 40 | |
41 | - /** |
|
42 | - * Retrieves a list of all available command IDs. |
|
43 | - * |
|
44 | - * @return string[] |
|
45 | - */ |
|
41 | + /** |
|
42 | + * Retrieves a list of all available command IDs. |
|
43 | + * |
|
44 | + * @return string[] |
|
45 | + */ |
|
46 | 46 | public function getIDs() : array |
47 | 47 | { |
48 | 48 | static $ids = array(); |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | return $result; |
89 | 89 | } |
90 | 90 | |
91 | - /** |
|
92 | - * Gets an available command by its ID. |
|
93 | - * |
|
94 | - * @param string $id |
|
95 | - * @return Mailcode_Commands_Command |
|
96 | - */ |
|
91 | + /** |
|
92 | + * Gets an available command by its ID. |
|
93 | + * |
|
94 | + * @param string $id |
|
95 | + * @return Mailcode_Commands_Command |
|
96 | + */ |
|
97 | 97 | public function getByID(string $id) : Mailcode_Commands_Command |
98 | 98 | { |
99 | 99 | static $instances = array(); |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | return $instances[$id]; |
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * Retrieves the ID of a command by its name. |
|
111 | - * |
|
112 | - * @param string $name |
|
113 | - * @throws Mailcode_Exception |
|
114 | - * @return string |
|
115 | - * |
|
116 | - * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST |
|
117 | - */ |
|
109 | + /** |
|
110 | + * Retrieves the ID of a command by its name. |
|
111 | + * |
|
112 | + * @param string $name |
|
113 | + * @throws Mailcode_Exception |
|
114 | + * @return string |
|
115 | + * |
|
116 | + * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST |
|
117 | + */ |
|
118 | 118 | public function getIDByName(string $name) : string |
119 | 119 | { |
120 | 120 | $items = $this->getAll(); |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | return $class; |
226 | 226 | } |
227 | 227 | |
228 | - /** |
|
229 | - * Translates the command type to the expected class naming scheme. |
|
230 | - * |
|
231 | - * Example: not-empty => NotEmpty |
|
232 | - * |
|
233 | - * @param string $type |
|
234 | - * @return string |
|
235 | - */ |
|
228 | + /** |
|
229 | + * Translates the command type to the expected class naming scheme. |
|
230 | + * |
|
231 | + * Example: not-empty => NotEmpty |
|
232 | + * |
|
233 | + * @param string $type |
|
234 | + * @return string |
|
235 | + */ |
|
236 | 236 | private function adjustTypeName(string $type) : string |
237 | 237 | { |
238 | 238 | $type = str_replace('-', ' ', $type); |