@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | abstract class Mailcode_Translator_Syntax_ApacheVelocity extends Mailcode_Translator_Command |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var string[] |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var string[] |
|
| 25 | + */ |
|
| 26 | 26 | private $regexSpecialChars = array( |
| 27 | 27 | '?', |
| 28 | 28 | '.', |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Filters the string for use in an Apache Velocity (Java) |
|
| 51 | - * regex string: escapes all special characters. |
|
| 52 | - * |
|
| 53 | - * @param string $string |
|
| 54 | - * @return string |
|
| 55 | - */ |
|
| 50 | + * Filters the string for use in an Apache Velocity (Java) |
|
| 51 | + * regex string: escapes all special characters. |
|
| 52 | + * |
|
| 53 | + * @param string $string |
|
| 54 | + * @return string |
|
| 55 | + */ |
|
| 56 | 56 | protected function filterRegexString(string $string) : string |
| 57 | 57 | { |
| 58 | 58 | // Special case: previously escaped quotes. |
@@ -26,24 +26,24 @@ discard block |
||
| 26 | 26 | const VALIDATION_EMPTY = 48801; |
| 27 | 27 | const VALIDATION_UNQUOTED_STRING_LITERALS = 48802; |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | 32 | protected $statement; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var OperationResult |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var OperationResult |
|
| 36 | + */ |
|
| 37 | 37 | protected $result; |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var Mailcode_Parser_Statement_Tokenizer |
|
| 41 | - */ |
|
| 39 | + /** |
|
| 40 | + * @var Mailcode_Parser_Statement_Tokenizer |
|
| 41 | + */ |
|
| 42 | 42 | protected $tokenizer; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var Mailcode_Parser_Statement_Info|NULL |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var Mailcode_Parser_Statement_Info|NULL |
|
| 46 | + */ |
|
| 47 | 47 | protected $info; |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if($unknown) |
| 113 | 113 | { |
| 114 | 114 | $this->result->makeError( |
| 115 | - t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')', |
|
| 115 | + t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')', |
|
| 116 | 116 | self::VALIDATION_UNQUOTED_STRING_LITERALS |
| 117 | 117 | ); |
| 118 | 118 | } |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | const ERROR_TOKENIZE_METHOD_MISSING = 49801; |
| 25 | 25 | const ERROR_INVALID_TOKEN_CREATED = 49802; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var string[] |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var string[] |
|
| 29 | + */ |
|
| 30 | 30 | protected $operands = array( |
| 31 | 31 | '==', |
| 32 | 32 | '<=', |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | '<' |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var string[] |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var string[] |
|
| 46 | + */ |
|
| 47 | 47 | protected $keywords = array(); |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @var string |
|
| 51 | - */ |
|
| 49 | + /** |
|
| 50 | + * @var string |
|
| 51 | + */ |
|
| 52 | 52 | protected $delimiter = '§§'; |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | 'extract_tokens' |
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @var Mailcode_Parser_Statement |
|
| 70 | - */ |
|
| 68 | + /** |
|
| 69 | + * @var Mailcode_Parser_Statement |
|
| 70 | + */ |
|
| 71 | 71 | protected $statement; |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @var string |
|
| 75 | - */ |
|
| 73 | + /** |
|
| 74 | + * @var string |
|
| 75 | + */ |
|
| 76 | 76 | protected $tokenized; |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * @var Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 80 | - */ |
|
| 78 | + /** |
|
| 79 | + * @var Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 80 | + */ |
|
| 81 | 81 | protected $tokensTemporary = array(); |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected $tokensOrdered = array(); |
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * @var string[] |
|
| 90 | - */ |
|
| 88 | + /** |
|
| 89 | + * @var string[] |
|
| 90 | + */ |
|
| 91 | 91 | protected static $ids = array(); |
| 92 | 92 | |
| 93 | 93 | public function __construct(Mailcode_Parser_Statement $statement) |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | $this->tokenize($statement->getStatementString()); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * Retrieves all tokens detected in the statement string, in |
|
| 103 | - * the order they were found. |
|
| 104 | - * |
|
| 105 | - * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 106 | - */ |
|
| 101 | + /** |
|
| 102 | + * Retrieves all tokens detected in the statement string, in |
|
| 103 | + * the order they were found. |
|
| 104 | + * |
|
| 105 | + * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 106 | + */ |
|
| 107 | 107 | public function getTokens() |
| 108 | 108 | { |
| 109 | 109 | return $this->tokensOrdered; |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | return !empty($this->tokensOrdered); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Whether there were any unknown tokens in the statement. |
|
| 119 | - * |
|
| 120 | - * @return bool |
|
| 121 | - */ |
|
| 117 | + /** |
|
| 118 | + * Whether there were any unknown tokens in the statement. |
|
| 119 | + * |
|
| 120 | + * @return bool |
|
| 121 | + */ |
|
| 122 | 122 | public function hasUnknown() : bool |
| 123 | 123 | { |
| 124 | 124 | $unknown = $this->getUnknown(); |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | return !empty($unknown); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * Retrieves all unknown content tokens, if any. |
|
| 131 | - * |
|
| 132 | - * @return \Mailcode\Mailcode_Parser_Statement_Tokenizer_Token_Unknown[] |
|
| 133 | - */ |
|
| 129 | + /** |
|
| 130 | + * Retrieves all unknown content tokens, if any. |
|
| 131 | + * |
|
| 132 | + * @return \Mailcode\Mailcode_Parser_Statement_Tokenizer_Token_Unknown[] |
|
| 133 | + */ |
|
| 134 | 134 | public function getUnknown() |
| 135 | 135 | { |
| 136 | 136 | $result = array(); |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Registers a token to add in the statement string. |
|
| 205 | - * |
|
| 206 | - * @param string $type |
|
| 207 | - * @param string $matchedText |
|
| 208 | - * @param mixed $subject |
|
| 209 | - */ |
|
| 203 | + /** |
|
| 204 | + * Registers a token to add in the statement string. |
|
| 205 | + * |
|
| 206 | + * @param string $type |
|
| 207 | + * @param string $matchedText |
|
| 208 | + * @param mixed $subject |
|
| 209 | + */ |
|
| 210 | 210 | protected function registerToken(string $type, string $matchedText, $subject=null) : void |
| 211 | 211 | { |
| 212 | 212 | $this->tokensTemporary[] = $this->createToken($type, $matchedText, $subject); |
@@ -285,11 +285,11 @@ discard block |
||
| 285 | 285 | return null; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - /** |
|
| 289 | - * Some WYSIWYG editors like using pretty quotes instead |
|
| 290 | - * of the usual double quotes. This simply replaces all |
|
| 291 | - * occurrences with the regular variant. |
|
| 292 | - */ |
|
| 288 | + /** |
|
| 289 | + * Some WYSIWYG editors like using pretty quotes instead |
|
| 290 | + * of the usual double quotes. This simply replaces all |
|
| 291 | + * occurrences with the regular variant. |
|
| 292 | + */ |
|
| 293 | 293 | protected function tokenize_normalize_quotes() : void |
| 294 | 294 | { |
| 295 | 295 | $this->tokenized = str_replace(array('“', '”'), '"', $this->tokenized); |
@@ -378,13 +378,13 @@ discard block |
||
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - /** |
|
| 382 | - * Generates a unique alphabet-based ID without numbers |
|
| 383 | - * to use as token name, to avoid conflicts with the |
|
| 384 | - * numbers detection. |
|
| 385 | - * |
|
| 386 | - * @return string |
|
| 387 | - */ |
|
| 381 | + /** |
|
| 382 | + * Generates a unique alphabet-based ID without numbers |
|
| 383 | + * to use as token name, to avoid conflicts with the |
|
| 384 | + * numbers detection. |
|
| 385 | + * |
|
| 386 | + * @return string |
|
| 387 | + */ |
|
| 388 | 388 | protected function generateID() : string |
| 389 | 389 | { |
| 390 | 390 | static $alphas; |
@@ -55,50 +55,50 @@ discard block |
||
| 55 | 55 | const ERROR_EMPTY_DELIMITER = 47803; |
| 56 | 56 | const ERROR_PLACEHOLDER_NOT_FOUND = 47804; |
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @var Mailcode_Parser |
|
| 60 | - */ |
|
| 58 | + /** |
|
| 59 | + * @var Mailcode_Parser |
|
| 60 | + */ |
|
| 61 | 61 | protected $parser; |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @var Mailcode_Collection |
|
| 65 | - */ |
|
| 63 | + /** |
|
| 64 | + * @var Mailcode_Collection |
|
| 65 | + */ |
|
| 66 | 66 | protected $commands; |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @var string |
|
| 70 | - */ |
|
| 68 | + /** |
|
| 69 | + * @var string |
|
| 70 | + */ |
|
| 71 | 71 | protected $originalString; |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @var Mailcode_Collection |
|
| 75 | - */ |
|
| 73 | + /** |
|
| 74 | + * @var Mailcode_Collection |
|
| 75 | + */ |
|
| 76 | 76 | protected $collection; |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Counter for the placeholders, global for all placeholders. |
|
| 80 | - * @var integer |
|
| 81 | - */ |
|
| 78 | + /** |
|
| 79 | + * Counter for the placeholders, global for all placeholders. |
|
| 80 | + * @var integer |
|
| 81 | + */ |
|
| 82 | 82 | private static $counter = 0; |
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * @var Mailcode_Parser_Safeguard_Placeholder[] |
|
| 86 | - */ |
|
| 84 | + /** |
|
| 85 | + * @var Mailcode_Parser_Safeguard_Placeholder[] |
|
| 86 | + */ |
|
| 87 | 87 | protected $placeholders; |
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @var string |
|
| 91 | - */ |
|
| 89 | + /** |
|
| 90 | + * @var string |
|
| 91 | + */ |
|
| 92 | 92 | protected $delimiter = '__'; |
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * @var string[]|NULL |
|
| 96 | - */ |
|
| 94 | + /** |
|
| 95 | + * @var string[]|NULL |
|
| 96 | + */ |
|
| 97 | 97 | protected $placeholderStrings; |
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * @var Mailcode_Parser_Safeguard_Formatting|NULL |
|
| 101 | - */ |
|
| 99 | + /** |
|
| 100 | + * @var Mailcode_Parser_Safeguard_Formatting|NULL |
|
| 101 | + */ |
|
| 102 | 102 | private $formatting = null; |
| 103 | 103 | |
| 104 | 104 | public function __construct(Mailcode_Parser $parser, string $subject) |
@@ -107,25 +107,25 @@ discard block |
||
| 107 | 107 | $this->originalString = $subject; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * Retrieves the string the safeguard was created for. |
|
| 112 | - * |
|
| 113 | - * @return string |
|
| 114 | - */ |
|
| 110 | + /** |
|
| 111 | + * Retrieves the string the safeguard was created for. |
|
| 112 | + * |
|
| 113 | + * @return string |
|
| 114 | + */ |
|
| 115 | 115 | public function getOriginalString() : string |
| 116 | 116 | { |
| 117 | 117 | return $this->originalString; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * Sets the delimiter character sequence used to prepend |
|
| 122 | - * and append to the placeholders. |
|
| 123 | - * |
|
| 124 | - * The delimiter's default is "__" (two underscores). |
|
| 125 | - * |
|
| 126 | - * @param string $delimiter |
|
| 127 | - * @return Mailcode_Parser_Safeguard |
|
| 128 | - */ |
|
| 120 | + /** |
|
| 121 | + * Sets the delimiter character sequence used to prepend |
|
| 122 | + * and append to the placeholders. |
|
| 123 | + * |
|
| 124 | + * The delimiter's default is "__" (two underscores). |
|
| 125 | + * |
|
| 126 | + * @param string $delimiter |
|
| 127 | + * @return Mailcode_Parser_Safeguard |
|
| 128 | + */ |
|
| 129 | 129 | public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard |
| 130 | 130 | { |
| 131 | 131 | if(empty($delimiter)) |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | return $this->delimiter; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Retrieves the safe string in which all commands have been replaced |
|
| 152 | - * by placeholder strings. |
|
| 153 | - * |
|
| 154 | - * @return string |
|
| 155 | - * @throws Mailcode_Exception |
|
| 156 | - * |
|
| 157 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 158 | - */ |
|
| 150 | + /** |
|
| 151 | + * Retrieves the safe string in which all commands have been replaced |
|
| 152 | + * by placeholder strings. |
|
| 153 | + * |
|
| 154 | + * @return string |
|
| 155 | + * @throws Mailcode_Exception |
|
| 156 | + * |
|
| 157 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 158 | + */ |
|
| 159 | 159 | public function makeSafe() : string |
| 160 | 160 | { |
| 161 | 161 | $this->requireValidCollection(); |
@@ -163,16 +163,16 @@ discard block |
||
| 163 | 163 | return $this->makeSafePartial(); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * Like makeSafe(), but allows partial (invalid) commands: use this |
|
| 168 | - * if the subject string may contain only part of the whole set of |
|
| 169 | - * commands. |
|
| 170 | - * |
|
| 171 | - * Example: parsing a text with an opening if statement, without the |
|
| 172 | - * matching end statement. |
|
| 173 | - * |
|
| 174 | - * @return string |
|
| 175 | - */ |
|
| 166 | + /** |
|
| 167 | + * Like makeSafe(), but allows partial (invalid) commands: use this |
|
| 168 | + * if the subject string may contain only part of the whole set of |
|
| 169 | + * commands. |
|
| 170 | + * |
|
| 171 | + * Example: parsing a text with an opening if statement, without the |
|
| 172 | + * matching end statement. |
|
| 173 | + * |
|
| 174 | + * @return string |
|
| 175 | + */ |
|
| 176 | 176 | public function makeSafePartial() : string |
| 177 | 177 | { |
| 178 | 178 | $placeholders = $this->getPlaceholders(); |
@@ -277,13 +277,13 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - /** |
|
| 281 | - * Creates a formatting handler, which can be used to specify |
|
| 282 | - * which formattings to use for the commands in the subject string. |
|
| 283 | - * |
|
| 284 | - * @param Mailcode_StringContainer|string $subject |
|
| 285 | - * @return Mailcode_Parser_Safeguard_Formatting |
|
| 286 | - */ |
|
| 280 | + /** |
|
| 281 | + * Creates a formatting handler, which can be used to specify |
|
| 282 | + * which formattings to use for the commands in the subject string. |
|
| 283 | + * |
|
| 284 | + * @param Mailcode_StringContainer|string $subject |
|
| 285 | + * @return Mailcode_Parser_Safeguard_Formatting |
|
| 286 | + */ |
|
| 287 | 287 | public function createFormatting($subject) : Mailcode_Parser_Safeguard_Formatting |
| 288 | 288 | { |
| 289 | 289 | if(is_string($subject)) |
@@ -294,12 +294,12 @@ discard block |
||
| 294 | 294 | return new Mailcode_Parser_Safeguard_Formatting($this, $subject); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - /** |
|
| 298 | - * Retrieves all placeholders that have to be added to |
|
| 299 | - * the subject text. |
|
| 300 | - * |
|
| 301 | - * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
| 302 | - */ |
|
| 297 | + /** |
|
| 298 | + * Retrieves all placeholders that have to be added to |
|
| 299 | + * the subject text. |
|
| 300 | + * |
|
| 301 | + * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
| 302 | + */ |
|
| 303 | 303 | public function getPlaceholders() |
| 304 | 304 | { |
| 305 | 305 | if(isset($this->placeholders)) |
@@ -368,16 +368,16 @@ discard block |
||
| 368 | 368 | return $string; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - /** |
|
| 372 | - * Makes the string whole again after transforming or filtering it, |
|
| 373 | - * by replacing the command placeholders with the original commands. |
|
| 374 | - * |
|
| 375 | - * @param string $string |
|
| 376 | - * @return string |
|
| 377 | - * @throws Mailcode_Exception |
|
| 378 | - * |
|
| 379 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 380 | - */ |
|
| 371 | + /** |
|
| 372 | + * Makes the string whole again after transforming or filtering it, |
|
| 373 | + * by replacing the command placeholders with the original commands. |
|
| 374 | + * |
|
| 375 | + * @param string $string |
|
| 376 | + * @return string |
|
| 377 | + * @throws Mailcode_Exception |
|
| 378 | + * |
|
| 379 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 380 | + */ |
|
| 381 | 381 | public function makeWhole(string $string) : string |
| 382 | 382 | { |
| 383 | 383 | return $this->restore( |
@@ -387,15 +387,15 @@ discard block |
||
| 387 | 387 | ); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - /** |
|
| 391 | - * Like `makeWhole()`, but ignores missing command placeholders. |
|
| 392 | - * |
|
| 393 | - * @param string $string |
|
| 394 | - * @return string |
|
| 395 | - * @throws Mailcode_Exception |
|
| 396 | - * |
|
| 397 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 398 | - */ |
|
| 390 | + /** |
|
| 391 | + * Like `makeWhole()`, but ignores missing command placeholders. |
|
| 392 | + * |
|
| 393 | + * @param string $string |
|
| 394 | + * @return string |
|
| 395 | + * @throws Mailcode_Exception |
|
| 396 | + * |
|
| 397 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 398 | + */ |
|
| 399 | 399 | public function makeWholePartial(string $string) : string |
| 400 | 400 | { |
| 401 | 401 | return $this->restore( |
@@ -405,19 +405,19 @@ discard block |
||
| 405 | 405 | ); |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - /** |
|
| 409 | - * Like `makeWhole()`, but replaces the commands with a syntax |
|
| 410 | - * highlighted version, meant for human readable texts only. |
|
| 411 | - * |
|
| 412 | - * Note: the commands lose their functionality (They cannot be |
|
| 413 | - * parsed from that string again). |
|
| 414 | - * |
|
| 415 | - * @param string $string |
|
| 416 | - * @return string |
|
| 417 | - * @throws Mailcode_Exception |
|
| 418 | - * |
|
| 419 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 420 | - */ |
|
| 408 | + /** |
|
| 409 | + * Like `makeWhole()`, but replaces the commands with a syntax |
|
| 410 | + * highlighted version, meant for human readable texts only. |
|
| 411 | + * |
|
| 412 | + * Note: the commands lose their functionality (They cannot be |
|
| 413 | + * parsed from that string again). |
|
| 414 | + * |
|
| 415 | + * @param string $string |
|
| 416 | + * @return string |
|
| 417 | + * @throws Mailcode_Exception |
|
| 418 | + * |
|
| 419 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 420 | + */ |
|
| 421 | 421 | public function makeHighlighted(string $string) : string |
| 422 | 422 | { |
| 423 | 423 | return $this->restore( |
@@ -427,15 +427,15 @@ discard block |
||
| 427 | 427 | ); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - /** |
|
| 431 | - * Like `makeHighlighted()`, but ignores missing command placeholders. |
|
| 432 | - * |
|
| 433 | - * @param string $string |
|
| 434 | - * @return string |
|
| 435 | - * @throws Mailcode_Exception |
|
| 436 | - * |
|
| 437 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 438 | - */ |
|
| 430 | + /** |
|
| 431 | + * Like `makeHighlighted()`, but ignores missing command placeholders. |
|
| 432 | + * |
|
| 433 | + * @param string $string |
|
| 434 | + * @return string |
|
| 435 | + * @throws Mailcode_Exception |
|
| 436 | + * |
|
| 437 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 438 | + */ |
|
| 439 | 439 | public function makeHighlightedPartial(string $string) : string |
| 440 | 440 | { |
| 441 | 441 | return $this->restore( |
@@ -445,11 +445,11 @@ discard block |
||
| 445 | 445 | ); |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - /** |
|
| 449 | - * Retrieves the commands collection contained in the string. |
|
| 450 | - * |
|
| 451 | - * @return Mailcode_Collection |
|
| 452 | - */ |
|
| 448 | + /** |
|
| 449 | + * Retrieves the commands collection contained in the string. |
|
| 450 | + * |
|
| 451 | + * @return Mailcode_Collection |
|
| 452 | + */ |
|
| 453 | 453 | public function getCollection() : Mailcode_Collection |
| 454 | 454 | { |
| 455 | 455 | if(isset($this->collection)) |
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | return $this->getCollection()->isValid(); |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - /** |
|
| 471 | - * @throws Mailcode_Exception |
|
| 472 | - * |
|
| 473 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 474 | - */ |
|
| 470 | + /** |
|
| 471 | + * @throws Mailcode_Exception |
|
| 472 | + * |
|
| 473 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 474 | + */ |
|
| 475 | 475 | protected function requireValidCollection() : void |
| 476 | 476 | { |
| 477 | 477 | if($this->getCollection()->isValid()) |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | ); |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - /** |
|
| 494 | - * Retrieves a list of all placeholder IDs used in the text. |
|
| 495 | - * |
|
| 496 | - * @return string[] |
|
| 497 | - */ |
|
| 493 | + /** |
|
| 494 | + * Retrieves a list of all placeholder IDs used in the text. |
|
| 495 | + * |
|
| 496 | + * @return string[] |
|
| 497 | + */ |
|
| 498 | 498 | public function getPlaceholderStrings() : array |
| 499 | 499 | { |
| 500 | 500 | if(is_array($this->placeholderStrings)) |
@@ -521,13 +521,13 @@ discard block |
||
| 521 | 521 | return in_array($subject, $ids); |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - /** |
|
| 525 | - * Retrieves a placeholder instance by its ID. |
|
| 526 | - * |
|
| 527 | - * @param int $id |
|
| 528 | - * @throws Mailcode_Exception If the placeholder was not found. |
|
| 529 | - * @return Mailcode_Parser_Safeguard_Placeholder |
|
| 530 | - */ |
|
| 524 | + /** |
|
| 525 | + * Retrieves a placeholder instance by its ID. |
|
| 526 | + * |
|
| 527 | + * @param int $id |
|
| 528 | + * @throws Mailcode_Exception If the placeholder was not found. |
|
| 529 | + * @return Mailcode_Parser_Safeguard_Placeholder |
|
| 530 | + */ |
|
| 531 | 531 | public function getPlaceholderByID(int $id) : Mailcode_Parser_Safeguard_Placeholder |
| 532 | 532 | { |
| 533 | 533 | $placeholders = $this->getPlaceholders(); |
@@ -550,13 +550,13 @@ discard block |
||
| 550 | 550 | ); |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | - /** |
|
| 554 | - * Retrieves a placeholder instance by its replacement text. |
|
| 555 | - * |
|
| 556 | - * @param string $string |
|
| 557 | - * @throws Mailcode_Exception |
|
| 558 | - * @return Mailcode_Parser_Safeguard_Placeholder |
|
| 559 | - */ |
|
| 553 | + /** |
|
| 554 | + * Retrieves a placeholder instance by its replacement text. |
|
| 555 | + * |
|
| 556 | + * @param string $string |
|
| 557 | + * @throws Mailcode_Exception |
|
| 558 | + * @return Mailcode_Parser_Safeguard_Placeholder |
|
| 559 | + */ |
|
| 560 | 560 | public function getPlaceholderByString(string $string) : Mailcode_Parser_Safeguard_Placeholder |
| 561 | 561 | { |
| 562 | 562 | $placeholders = $this->getPlaceholders(); |
@@ -37,44 +37,44 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | const META_URL_ENCODING = 'url_encoding'; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | 43 | protected $type = ''; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var string |
|
| 47 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var string |
|
| 47 | + */ |
|
| 48 | 48 | protected $paramsString = ''; |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | 53 | protected $matchedText = ''; |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var string |
|
| 57 | - */ |
|
| 55 | + /** |
|
| 56 | + * @var string |
|
| 57 | + */ |
|
| 58 | 58 | protected $hash = ''; |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @var OperationResult |
|
| 62 | - */ |
|
| 60 | + /** |
|
| 61 | + * @var OperationResult |
|
| 62 | + */ |
|
| 63 | 63 | protected $validationResult = null; |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @var \Mailcode\Mailcode |
|
| 67 | - */ |
|
| 65 | + /** |
|
| 66 | + * @var \Mailcode\Mailcode |
|
| 67 | + */ |
|
| 68 | 68 | protected $mailcode; |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @var \Mailcode\Mailcode_Parser_Statement |
|
| 72 | - */ |
|
| 70 | + /** |
|
| 71 | + * @var \Mailcode\Mailcode_Parser_Statement |
|
| 72 | + */ |
|
| 73 | 73 | protected $params; |
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * @var string[] |
|
| 77 | - */ |
|
| 75 | + /** |
|
| 76 | + * @var string[] |
|
| 77 | + */ |
|
| 78 | 78 | protected $validations = array( |
| 79 | 79 | 'params_empty', |
| 80 | 80 | 'params_keywords', |
@@ -83,24 +83,24 @@ discard block |
||
| 83 | 83 | 'type_unsupported' |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * @var string |
|
| 88 | - */ |
|
| 86 | + /** |
|
| 87 | + * @var string |
|
| 88 | + */ |
|
| 89 | 89 | protected $comment = ''; |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * @var Mailcode_Commands_LogicKeywords|NULL |
|
| 93 | - */ |
|
| 91 | + /** |
|
| 92 | + * @var Mailcode_Commands_LogicKeywords|NULL |
|
| 93 | + */ |
|
| 94 | 94 | protected $logicKeywords; |
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * @var Mailcode_Parser_Statement_Validator |
|
| 98 | - */ |
|
| 96 | + /** |
|
| 97 | + * @var Mailcode_Parser_Statement_Validator |
|
| 98 | + */ |
|
| 99 | 99 | protected $validator; |
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * @var boolean |
|
| 103 | - */ |
|
| 101 | + /** |
|
| 102 | + * @var boolean |
|
| 103 | + */ |
|
| 104 | 104 | private $validated = false; |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -130,13 +130,13 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * Sets the command's parent opening command, if any. |
|
| 135 | - * NOTE: This is set automatically by the parser, and |
|
| 136 | - * should not be called manually. |
|
| 137 | - * |
|
| 138 | - * @param Mailcode_Commands_Command $command |
|
| 139 | - */ |
|
| 133 | + /** |
|
| 134 | + * Sets the command's parent opening command, if any. |
|
| 135 | + * NOTE: This is set automatically by the parser, and |
|
| 136 | + * should not be called manually. |
|
| 137 | + * |
|
| 138 | + * @param Mailcode_Commands_Command $command |
|
| 139 | + */ |
|
| 140 | 140 | public function setParent(Mailcode_Commands_Command $command) : void |
| 141 | 141 | { |
| 142 | 142 | $this->parent = $command; |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | return $this->parent; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * @return string The ID of the command = the name of the command class file. |
|
| 157 | - */ |
|
| 155 | + /** |
|
| 156 | + * @return string The ID of the command = the name of the command class file. |
|
| 157 | + */ |
|
| 158 | 158 | public function getID() : string |
| 159 | 159 | { |
| 160 | 160 | // account for commands with types: If_Variable should still return If. |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | return array_shift($tokens); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * Sets an optional comment that is not used anywhere, but |
|
| 168 | - * can be used by the application to track why a command is |
|
| 169 | - * used somewhere. |
|
| 170 | - * |
|
| 171 | - * @param string $comment |
|
| 172 | - * @return Mailcode_Commands_Command |
|
| 173 | - */ |
|
| 166 | + /** |
|
| 167 | + * Sets an optional comment that is not used anywhere, but |
|
| 168 | + * can be used by the application to track why a command is |
|
| 169 | + * used somewhere. |
|
| 170 | + * |
|
| 171 | + * @param string $comment |
|
| 172 | + * @return Mailcode_Commands_Command |
|
| 173 | + */ |
|
| 174 | 174 | public function setComment(string $comment) : Mailcode_Commands_Command |
| 175 | 175 | { |
| 176 | 176 | $this->comment = $comment; |
@@ -178,34 +178,34 @@ discard block |
||
| 178 | 178 | return $this; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - /** |
|
| 182 | - * Retrieves the previously set comment, if any. |
|
| 183 | - * |
|
| 184 | - * @return string |
|
| 185 | - */ |
|
| 181 | + /** |
|
| 182 | + * Retrieves the previously set comment, if any. |
|
| 183 | + * |
|
| 184 | + * @return string |
|
| 185 | + */ |
|
| 186 | 186 | public function getComment() : string |
| 187 | 187 | { |
| 188 | 188 | return $this->comment; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - /** |
|
| 192 | - * Checks whether this is a dummy command, which is only |
|
| 193 | - * used to access information on the command type. It cannot |
|
| 194 | - * be used as an actual live command. |
|
| 195 | - * |
|
| 196 | - * @return bool |
|
| 197 | - */ |
|
| 191 | + /** |
|
| 192 | + * Checks whether this is a dummy command, which is only |
|
| 193 | + * used to access information on the command type. It cannot |
|
| 194 | + * be used as an actual live command. |
|
| 195 | + * |
|
| 196 | + * @return bool |
|
| 197 | + */ |
|
| 198 | 198 | public function isDummy() : bool |
| 199 | 199 | { |
| 200 | 200 | return $this->type === '__dummy'; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Retrieves a hash of the actual matched command string, |
|
| 205 | - * which is used in collections to detect duplicate commands. |
|
| 206 | - * |
|
| 207 | - * @return string |
|
| 208 | - */ |
|
| 203 | + /** |
|
| 204 | + * Retrieves a hash of the actual matched command string, |
|
| 205 | + * which is used in collections to detect duplicate commands. |
|
| 206 | + * |
|
| 207 | + * @return string |
|
| 208 | + */ |
|
| 209 | 209 | public function getHash() : string |
| 210 | 210 | { |
| 211 | 211 | $this->requireNonDummy(); |
@@ -307,9 +307,9 @@ discard block |
||
| 307 | 307 | return $this->validationResult->isValid(); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - /** |
|
| 311 | - * @return string[] |
|
| 312 | - */ |
|
| 310 | + /** |
|
| 311 | + * @return string[] |
|
| 312 | + */ |
|
| 313 | 313 | abstract protected function getValidations() : array; |
| 314 | 314 | |
| 315 | 315 | protected function validateSyntax_params_empty() : void |
@@ -478,12 +478,12 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | abstract public function supportsURLEncoding() : bool; |
| 480 | 480 | |
| 481 | - /** |
|
| 482 | - * Whether the command allows using logic keywords like "and:" or "or:" |
|
| 483 | - * in the command parameters. |
|
| 484 | - * |
|
| 485 | - * @return bool |
|
| 486 | - */ |
|
| 481 | + /** |
|
| 482 | + * Whether the command allows using logic keywords like "and:" or "or:" |
|
| 483 | + * in the command parameters. |
|
| 484 | + * |
|
| 485 | + * @return bool |
|
| 486 | + */ |
|
| 487 | 487 | abstract public function supportsLogicKeywords() : bool; |
| 488 | 488 | |
| 489 | 489 | abstract public function generatesContent() : bool; |
@@ -529,22 +529,22 @@ discard block |
||
| 529 | 529 | return $normalizer->normalize(); |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | - /** |
|
| 533 | - * Retrieves the names of all the command's supported types: the part |
|
| 534 | - * between the command name and the colon. Example: {command type: params}. |
|
| 535 | - * |
|
| 536 | - * @return string[] |
|
| 537 | - */ |
|
| 532 | + /** |
|
| 533 | + * Retrieves the names of all the command's supported types: the part |
|
| 534 | + * between the command name and the colon. Example: {command type: params}. |
|
| 535 | + * |
|
| 536 | + * @return string[] |
|
| 537 | + */ |
|
| 538 | 538 | public function getSupportedTypes() : array |
| 539 | 539 | { |
| 540 | 540 | return array(); |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - /** |
|
| 544 | - * Retrieves all variable names used in the command. |
|
| 545 | - * |
|
| 546 | - * @return Mailcode_Variables_Collection_Regular |
|
| 547 | - */ |
|
| 543 | + /** |
|
| 544 | + * Retrieves all variable names used in the command. |
|
| 545 | + * |
|
| 546 | + * @return Mailcode_Variables_Collection_Regular |
|
| 547 | + */ |
|
| 548 | 548 | public function getVariables() : Mailcode_Variables_Collection_Regular |
| 549 | 549 | { |
| 550 | 550 | return Mailcode::create()->findVariables($this->paramsString); |
@@ -569,26 +569,26 @@ discard block |
||
| 569 | 569 | ); |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - /** |
|
| 573 | - * Sets a parameter for the translation backend. The backend can use |
|
| 574 | - * these to allow command-specific configurations. |
|
| 575 | - * |
|
| 576 | - * @param string $name |
|
| 577 | - * @param mixed $value |
|
| 578 | - * @return $this |
|
| 579 | - */ |
|
| 572 | + /** |
|
| 573 | + * Sets a parameter for the translation backend. The backend can use |
|
| 574 | + * these to allow command-specific configurations. |
|
| 575 | + * |
|
| 576 | + * @param string $name |
|
| 577 | + * @param mixed $value |
|
| 578 | + * @return $this |
|
| 579 | + */ |
|
| 580 | 580 | public function setTranslationParam(string $name, $value) |
| 581 | 581 | { |
| 582 | 582 | $this->translationParams[$name] = $value; |
| 583 | 583 | return $this; |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - /** |
|
| 587 | - * Retrieves a previously set translation parameter. |
|
| 588 | - * |
|
| 589 | - * @param string $name |
|
| 590 | - * @return mixed |
|
| 591 | - */ |
|
| 586 | + /** |
|
| 587 | + * Retrieves a previously set translation parameter. |
|
| 588 | + * |
|
| 589 | + * @param string $name |
|
| 590 | + * @return mixed |
|
| 591 | + */ |
|
| 592 | 592 | public function getTranslationParam(string $name) |
| 593 | 593 | { |
| 594 | 594 | if(isset($this->translationParams[$name])) |
@@ -28,14 +28,14 @@ discard block |
||
| 28 | 28 | '{\s*([a-z]+)\s+([a-z-]+)\s*:([^}]*)}' |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var Mailcode |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var Mailcode |
|
| 33 | + */ |
|
| 34 | 34 | protected $mailcode; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var Mailcode_Commands |
|
| 38 | - */ |
|
| 36 | + /** |
|
| 37 | + * @var Mailcode_Commands |
|
| 38 | + */ |
|
| 39 | 39 | protected $commands; |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -49,24 +49,24 @@ discard block |
||
| 49 | 49 | $this->commands = $this->mailcode->getCommands(); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Gets the regex format string used to detect commands. |
|
| 54 | - * |
|
| 55 | - * @return string |
|
| 56 | - */ |
|
| 52 | + /** |
|
| 53 | + * Gets the regex format string used to detect commands. |
|
| 54 | + * |
|
| 55 | + * @return string |
|
| 56 | + */ |
|
| 57 | 57 | protected static function getRegex() : string |
| 58 | 58 | { |
| 59 | 59 | return '/'.implode('|', self::COMMAND_REGEX_PARTS).'/sixU'; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Parses a string to detect all commands within. Returns a |
|
| 64 | - * collection instance that contains information on all the |
|
| 65 | - * commands. |
|
| 66 | - * |
|
| 67 | - * @param string $string |
|
| 68 | - * @return Mailcode_Collection A collection with all unique commands found. |
|
| 69 | - */ |
|
| 62 | + /** |
|
| 63 | + * Parses a string to detect all commands within. Returns a |
|
| 64 | + * collection instance that contains information on all the |
|
| 65 | + * commands. |
|
| 66 | + * |
|
| 67 | + * @param string $string |
|
| 68 | + * @return Mailcode_Collection A collection with all unique commands found. |
|
| 69 | + */ |
|
| 70 | 70 | public function parseString(string $string) : Mailcode_Collection |
| 71 | 71 | { |
| 72 | 72 | $collection = new Mailcode_Collection(); |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | return preg_replace('%<style\b[^>]*>(.*?)</style>%six', '', $subject); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Processes a single match found in the string: creates the command, |
|
| 104 | - * and adds it to the collection if it's a valid command, or to the list |
|
| 105 | - * of invalid commands otherwise. |
|
| 106 | - * |
|
| 107 | - * @param Mailcode_Parser_Match $match |
|
| 108 | - * @param Mailcode_Collection $collection |
|
| 109 | - */ |
|
| 102 | + /** |
|
| 103 | + * Processes a single match found in the string: creates the command, |
|
| 104 | + * and adds it to the collection if it's a valid command, or to the list |
|
| 105 | + * of invalid commands otherwise. |
|
| 106 | + * |
|
| 107 | + * @param Mailcode_Parser_Match $match |
|
| 108 | + * @param Mailcode_Collection $collection |
|
| 109 | + */ |
|
| 110 | 110 | protected function processMatch(Mailcode_Parser_Match $match, Mailcode_Collection $collection) : void |
| 111 | 111 | { |
| 112 | 112 | $name = $match->getName(); |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - /** |
|
| 160 | - * Parses a single regex match: determines which named group |
|
| 161 | - * matches, and retrieves the according information. |
|
| 162 | - * |
|
| 163 | - * @param array[] $matches The regex results array. |
|
| 164 | - * @param int $index The matched index. |
|
| 165 | - * @return Mailcode_Parser_Match |
|
| 166 | - */ |
|
| 159 | + /** |
|
| 160 | + * Parses a single regex match: determines which named group |
|
| 161 | + * matches, and retrieves the according information. |
|
| 162 | + * |
|
| 163 | + * @param array[] $matches The regex results array. |
|
| 164 | + * @param int $index The matched index. |
|
| 165 | + * @return Mailcode_Parser_Match |
|
| 166 | + */ |
|
| 167 | 167 | protected function parseMatch(array $matches, int $index) : Mailcode_Parser_Match |
| 168 | 168 | { |
| 169 | 169 | $name = ''; // the command name, e.g. "showvar" |
@@ -201,27 +201,27 @@ discard block |
||
| 201 | 201 | ); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Creates an instance of the safeguard tool, which |
|
| 206 | - * is used to safeguard commands in a string with placeholders. |
|
| 207 | - * |
|
| 208 | - * @param string $subject The string to use to safeguard commands in. |
|
| 209 | - * @return Mailcode_Parser_Safeguard |
|
| 210 | - * @see Mailcode_Parser_Safeguard |
|
| 211 | - */ |
|
| 204 | + /** |
|
| 205 | + * Creates an instance of the safeguard tool, which |
|
| 206 | + * is used to safeguard commands in a string with placeholders. |
|
| 207 | + * |
|
| 208 | + * @param string $subject The string to use to safeguard commands in. |
|
| 209 | + * @return Mailcode_Parser_Safeguard |
|
| 210 | + * @see Mailcode_Parser_Safeguard |
|
| 211 | + */ |
|
| 212 | 212 | public function createSafeguard(string $subject) : Mailcode_Parser_Safeguard |
| 213 | 213 | { |
| 214 | 214 | return new Mailcode_Parser_Safeguard($this, $subject); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - /** |
|
| 218 | - * Creates a statement parser, which is used to validate arbitrary |
|
| 219 | - * command statements. |
|
| 220 | - * |
|
| 221 | - * @param string $statement |
|
| 222 | - * @param bool $freeform |
|
| 223 | - * @return Mailcode_Parser_Statement |
|
| 224 | - */ |
|
| 217 | + /** |
|
| 218 | + * Creates a statement parser, which is used to validate arbitrary |
|
| 219 | + * command statements. |
|
| 220 | + * |
|
| 221 | + * @param string $statement |
|
| 222 | + * @param bool $freeform |
|
| 223 | + * @return Mailcode_Parser_Statement |
|
| 224 | + */ |
|
| 225 | 225 | public function createStatement(string $statement, bool $freeform=false) : Mailcode_Parser_Statement |
| 226 | 226 | { |
| 227 | 227 | return new Mailcode_Parser_Statement($statement, $freeform); |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | trait Mailcode_Traits_Commands_Validation_Variable |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 29 | + */ |
|
| 30 | 30 | protected $variableToken; |
| 31 | 31 | |
| 32 | 32 | protected function validateSyntax_variable() : void |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | ); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Retrieves the variable being compared. |
|
| 65 | - * |
|
| 66 | - * @return Mailcode_Variables_Variable |
|
| 67 | - */ |
|
| 63 | + /** |
|
| 64 | + * Retrieves the variable being compared. |
|
| 65 | + * |
|
| 66 | + * @return Mailcode_Variables_Variable |
|
| 67 | + */ |
|
| 68 | 68 | public function getVariable() : Mailcode_Variables_Variable |
| 69 | 69 | { |
| 70 | 70 | if(isset($this->variableToken)) |