@@ -23,14 +23,14 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class Mailcode_Parser_Safeguard_Formatter_Type_SingleLines extends Mailcode_Parser_Safeguard_Formatter_FormatType |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | 29 | private $eol; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var int |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var int |
|
| 33 | + */ |
|
| 34 | 34 | private $eolLength; |
| 35 | 35 | |
| 36 | 36 | protected function initFormatting() : void |
@@ -25,14 +25,14 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class Mailcode_Parser_Safeguard_Formatter_Type_SingleLines_Location extends Mailcode_Parser_Safeguard_Formatter_Location |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * @var int |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var int |
|
| 30 | + */ |
|
| 31 | 31 | protected $eolLength; |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var string |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var string |
|
| 35 | + */ |
|
| 36 | 36 | protected $eol; |
| 37 | 37 | |
| 38 | 38 | protected function init() : void |
@@ -25,11 +25,11 @@ |
||
| 25 | 25 | return PHP_INT_MAX; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Formats the specified string according to the formatter. |
|
| 30 | - * Retrieve the updated string from the string container used |
|
| 31 | - * to create the formatter, or use `getSubjectString()`. |
|
| 32 | - */ |
|
| 28 | + /** |
|
| 29 | + * Formats the specified string according to the formatter. |
|
| 30 | + * Retrieve the updated string from the string container used |
|
| 31 | + * to create the formatter, or use `getSubjectString()`. |
|
| 32 | + */ |
|
| 33 | 33 | public function format() : void |
| 34 | 34 | { |
| 35 | 35 | $locations = $this->resolveLocations(); |
@@ -24,9 +24,9 @@ |
||
| 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 |
@@ -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 |
@@ -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( |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | trait Mailcode_Traits_Commands_Validation_Multiline |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @var boolean |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var boolean |
|
| 31 | + */ |
|
| 32 | 32 | protected $multiline = 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 $multilineToken; |
| 38 | 38 | |
| 39 | 39 | protected function validateSyntax_multiline() : void |
@@ -30,19 +30,19 @@ |
||
| 30 | 30 | public const VALIDATION_UNCLOSED_COMMAND = 49104; |
| 31 | 31 | public const VALIDATION_CLOSING_NON_OPENING_COMMAND = 49105; |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var Mailcode_Collection |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var Mailcode_Collection |
|
| 35 | + */ |
|
| 36 | 36 | protected $collection; |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @var OperationResult |
|
| 40 | - */ |
|
| 38 | + /** |
|
| 39 | + * @var OperationResult |
|
| 40 | + */ |
|
| 41 | 41 | protected $validationResult; |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @var Mailcode_Commands_Command_Type[] |
|
| 45 | - */ |
|
| 43 | + /** |
|
| 44 | + * @var Mailcode_Commands_Command_Type[] |
|
| 45 | + */ |
|
| 46 | 46 | protected $stack = array(); |
| 47 | 47 | |
| 48 | 48 | public function __construct(Mailcode_Collection $collection) |
@@ -32,29 +32,29 @@ discard block |
||
| 32 | 32 | public const ERROR_TOO_MANY_REPLACERS = 65902; |
| 33 | 33 | public const ERROR_NO_FORMATTERS_ADDED = 65903; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var Mailcode_Parser_Safeguard |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var Mailcode_Parser_Safeguard |
|
| 37 | + */ |
|
| 38 | 38 | private $safeguard; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var Mailcode_Parser_Safeguard_Formatter[] |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var Mailcode_Parser_Safeguard_Formatter[] |
|
| 42 | + */ |
|
| 43 | 43 | private $formatters = array(); |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var Mailcode_StringContainer |
|
| 47 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var Mailcode_StringContainer |
|
| 47 | + */ |
|
| 48 | 48 | private $subject; |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var boolean |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var boolean |
|
| 52 | + */ |
|
| 53 | 53 | private $applied = false; |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var boolean |
|
| 57 | - */ |
|
| 55 | + /** |
|
| 56 | + * @var boolean |
|
| 57 | + */ |
|
| 58 | 58 | private $partial = false; |
| 59 | 59 | |
| 60 | 60 | public function __construct(Mailcode_Parser_Safeguard $safeguard, Mailcode_StringContainer $subject) |
@@ -96,17 +96,17 @@ discard block |
||
| 96 | 96 | return $formatter; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Adds a formatter that will surround all variables with |
|
| 101 | - * markup to highlight them independently of command syntax |
|
| 102 | - * highlighting. |
|
| 103 | - * |
|
| 104 | - * This is used to mark variables visually even after commands |
|
| 105 | - * have been replaced by the target system's post processing. |
|
| 106 | - * Can be combined with a replacer and other formats. |
|
| 107 | - * |
|
| 108 | - * @return Mailcode_Parser_Safeguard_Formatter_Type_MarkVariables |
|
| 109 | - */ |
|
| 99 | + /** |
|
| 100 | + * Adds a formatter that will surround all variables with |
|
| 101 | + * markup to highlight them independently of command syntax |
|
| 102 | + * highlighting. |
|
| 103 | + * |
|
| 104 | + * This is used to mark variables visually even after commands |
|
| 105 | + * have been replaced by the target system's post processing. |
|
| 106 | + * Can be combined with a replacer and other formats. |
|
| 107 | + * |
|
| 108 | + * @return Mailcode_Parser_Safeguard_Formatter_Type_MarkVariables |
|
| 109 | + */ |
|
| 110 | 110 | public function formatWithMarkedVariables() : Mailcode_Parser_Safeguard_Formatter_Type_MarkVariables |
| 111 | 111 | { |
| 112 | 112 | $formatter = $this->createMarkVariables(); |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Counts the amount of replacer formatters that have been added. |
|
| 205 | - * |
|
| 206 | - * @return int |
|
| 207 | - */ |
|
| 203 | + /** |
|
| 204 | + * Counts the amount of replacer formatters that have been added. |
|
| 205 | + * |
|
| 206 | + * @return int |
|
| 207 | + */ |
|
| 208 | 208 | private function countReplacers() : int |
| 209 | 209 | { |
| 210 | 210 | $count = 0; |
@@ -220,37 +220,37 @@ discard block |
||
| 220 | 220 | return $count; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - /** |
|
| 224 | - * Creates a formatter that adds HTML syntax highlighting |
|
| 225 | - * for all commands in the specified string, intelligently |
|
| 226 | - * checking the location of the commands to ensure that they |
|
| 227 | - * can be syntax highlighted. |
|
| 228 | - * |
|
| 229 | - * For example, commands in HTML attributes will not be |
|
| 230 | - * highlighted, as this would break the HTML. |
|
| 231 | - * |
|
| 232 | - * @return Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting |
|
| 233 | - */ |
|
| 223 | + /** |
|
| 224 | + * Creates a formatter that adds HTML syntax highlighting |
|
| 225 | + * for all commands in the specified string, intelligently |
|
| 226 | + * checking the location of the commands to ensure that they |
|
| 227 | + * can be syntax highlighted. |
|
| 228 | + * |
|
| 229 | + * For example, commands in HTML attributes will not be |
|
| 230 | + * highlighted, as this would break the HTML. |
|
| 231 | + * |
|
| 232 | + * @return Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting |
|
| 233 | + */ |
|
| 234 | 234 | public function createHTMLHighlighting() : Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting |
| 235 | 235 | { |
| 236 | 236 | return new Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting($this); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - /** |
|
| 240 | - * Creates the formatter that ensures that all commands |
|
| 241 | - * are placed on a separate line in the subject string. |
|
| 242 | - */ |
|
| 239 | + /** |
|
| 240 | + * Creates the formatter that ensures that all commands |
|
| 241 | + * are placed on a separate line in the subject string. |
|
| 242 | + */ |
|
| 243 | 243 | public function createSingleLines() : Mailcode_Parser_Safeguard_Formatter_Type_SingleLines |
| 244 | 244 | { |
| 245 | 245 | return new Mailcode_Parser_Safeguard_Formatter_Type_SingleLines($this); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - /** |
|
| 249 | - * Creates the formatter that replaces all commands by |
|
| 250 | - * their normalized variants. |
|
| 251 | - * |
|
| 252 | - * @return Mailcode_Parser_Safeguard_Formatter_Type_Normalized |
|
| 253 | - */ |
|
| 248 | + /** |
|
| 249 | + * Creates the formatter that replaces all commands by |
|
| 250 | + * their normalized variants. |
|
| 251 | + * |
|
| 252 | + * @return Mailcode_Parser_Safeguard_Formatter_Type_Normalized |
|
| 253 | + */ |
|
| 254 | 254 | public function createNormalized() : Mailcode_Parser_Safeguard_Formatter_Type_Normalized |
| 255 | 255 | { |
| 256 | 256 | return new Mailcode_Parser_Safeguard_Formatter_Type_Normalized($this); |
@@ -278,26 +278,26 @@ discard block |
||
| 278 | 278 | return $this->subject->getString(); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - /** |
|
| 282 | - * Whether the formatting is done partially: missing placeholders |
|
| 283 | - * will simply be ignored. |
|
| 284 | - * |
|
| 285 | - * @return bool |
|
| 286 | - */ |
|
| 281 | + /** |
|
| 282 | + * Whether the formatting is done partially: missing placeholders |
|
| 283 | + * will simply be ignored. |
|
| 284 | + * |
|
| 285 | + * @return bool |
|
| 286 | + */ |
|
| 287 | 287 | public function isPartial() : bool |
| 288 | 288 | { |
| 289 | 289 | return $this->partial; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * The formatting will ignore missing placeholders. Use this if the |
|
| 294 | - * formatting will be done on a text that may not contain all of the |
|
| 295 | - * initial placeholders anymore. |
|
| 296 | - * |
|
| 297 | - * This is like the safeguard's makeWholePartial() method. |
|
| 298 | - * |
|
| 299 | - * @return Mailcode_Parser_Safeguard_Formatting |
|
| 300 | - */ |
|
| 292 | + /** |
|
| 293 | + * The formatting will ignore missing placeholders. Use this if the |
|
| 294 | + * formatting will be done on a text that may not contain all of the |
|
| 295 | + * initial placeholders anymore. |
|
| 296 | + * |
|
| 297 | + * This is like the safeguard's makeWholePartial() method. |
|
| 298 | + * |
|
| 299 | + * @return Mailcode_Parser_Safeguard_Formatting |
|
| 300 | + */ |
|
| 301 | 301 | public function makePartial() : Mailcode_Parser_Safeguard_Formatting |
| 302 | 302 | { |
| 303 | 303 | $this->partial = true; |