@@ -104,12 +104,12 @@ |
||
| 104 | 104 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarNotEqualsString', $command); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * @param string $variable |
|
| 109 | - * @param string[] $searchTerms |
|
| 110 | - * @param bool $caseInsensitive |
|
| 111 | - * @return Mailcode_Commands_Command_ElseIf_Contains |
|
| 112 | - */ |
|
| 107 | + /** |
|
| 108 | + * @param string $variable |
|
| 109 | + * @param string[] $searchTerms |
|
| 110 | + * @param bool $caseInsensitive |
|
| 111 | + * @return Mailcode_Commands_Command_ElseIf_Contains |
|
| 112 | + */ |
|
| 113 | 113 | public function elseIfContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
| 114 | 114 | { |
| 115 | 115 | $command = $this->instantiator->buildIfContains('ElseIf', $variable, $searchTerms, $caseInsensitive); |
@@ -128,12 +128,12 @@ |
||
| 128 | 128 | throw $this->instantiator->exceptionUnexpectedType('IfNotEmpty', $command); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * @param string $variable |
|
| 133 | - * @param string[] $searchTerms |
|
| 134 | - * @param bool $caseInsensitive |
|
| 135 | - * @return Mailcode_Commands_Command_If_Contains |
|
| 136 | - */ |
|
| 131 | + /** |
|
| 132 | + * @param string $variable |
|
| 133 | + * @param string[] $searchTerms |
|
| 134 | + * @param bool $caseInsensitive |
|
| 135 | + * @return Mailcode_Commands_Command_If_Contains |
|
| 136 | + */ |
|
| 137 | 137 | public function ifContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
| 138 | 138 | { |
| 139 | 139 | $command = $this->instantiator->buildIfContains('If', $variable, $searchTerms, $caseInsensitive); |
@@ -117,13 +117,13 @@ |
||
| 117 | 117 | ); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * |
|
| 122 | - * @param Mailcode_Variables_Variable $variable |
|
| 123 | - * @param bool $caseSensitive |
|
| 124 | - * @param Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] $searchTerms |
|
| 125 | - * @return string |
|
| 126 | - */ |
|
| 120 | + /** |
|
| 121 | + * |
|
| 122 | + * @param Mailcode_Variables_Variable $variable |
|
| 123 | + * @param bool $caseSensitive |
|
| 124 | + * @param Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] $searchTerms |
|
| 125 | + * @return string |
|
| 126 | + */ |
|
| 127 | 127 | protected function _translateContains(Mailcode_Variables_Variable $variable, bool $caseSensitive, array $searchTerms) : string |
| 128 | 128 | { |
| 129 | 129 | $parts = array(); |
@@ -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 | '.', |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | ')' |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Filters the string for use in an Apache Velocity (Java) |
|
| 46 | - * regex string: escapes all special characters. |
|
| 47 | - * |
|
| 48 | - * @param string $string |
|
| 49 | - * @return string |
|
| 50 | - */ |
|
| 44 | + /** |
|
| 45 | + * Filters the string for use in an Apache Velocity (Java) |
|
| 46 | + * regex string: escapes all special characters. |
|
| 47 | + * |
|
| 48 | + * @param string $string |
|
| 49 | + * @return string |
|
| 50 | + */ |
|
| 51 | 51 | protected function filterRegexString(string $string) : string |
| 52 | 52 | { |
| 53 | 53 | // Special case: previously escaped quotes. |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | const ERROR_TOKENIZE_METHOD_MISSING = 49801; |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var string[] |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var string[] |
|
| 28 | + */ |
|
| 29 | 29 | protected $operands = array( |
| 30 | 30 | '==', |
| 31 | 31 | '<=', |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | '<' |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @var string[] |
|
| 45 | - */ |
|
| 43 | + /** |
|
| 44 | + * @var string[] |
|
| 45 | + */ |
|
| 46 | 46 | protected $keywords = array( |
| 47 | 47 | 'in:', |
| 48 | 48 | 'insensitive:' |
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @var string |
|
| 53 | - */ |
|
| 51 | + /** |
|
| 52 | + * @var string |
|
| 53 | + */ |
|
| 54 | 54 | protected $delimiter = '§§'; |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -67,19 +67,19 @@ discard block |
||
| 67 | 67 | 'extract_tokens' |
| 68 | 68 | ); |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @var Mailcode_Parser_Statement |
|
| 72 | - */ |
|
| 70 | + /** |
|
| 71 | + * @var Mailcode_Parser_Statement |
|
| 72 | + */ |
|
| 73 | 73 | protected $statement; |
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * @var string |
|
| 77 | - */ |
|
| 75 | + /** |
|
| 76 | + * @var string |
|
| 77 | + */ |
|
| 78 | 78 | protected $tokenized; |
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @var Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 82 | - */ |
|
| 80 | + /** |
|
| 81 | + * @var Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 82 | + */ |
|
| 83 | 83 | protected $tokensTemporary = array(); |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | protected $tokensOrdered = array(); |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * @var string[] |
|
| 92 | - */ |
|
| 90 | + /** |
|
| 91 | + * @var string[] |
|
| 92 | + */ |
|
| 93 | 93 | protected static $ids = array(); |
| 94 | 94 | |
| 95 | 95 | public function __construct(Mailcode_Parser_Statement $statement) |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | $this->tokenize($statement->getStatementString()); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Retrieves all tokens detected in the statement string, in |
|
| 104 | - * the order they were found. |
|
| 105 | - * |
|
| 106 | - * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 107 | - */ |
|
| 102 | + /** |
|
| 103 | + * Retrieves all tokens detected in the statement string, in |
|
| 104 | + * the order they were found. |
|
| 105 | + * |
|
| 106 | + * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 107 | + */ |
|
| 108 | 108 | public function getTokens() |
| 109 | 109 | { |
| 110 | 110 | return $this->tokensOrdered; |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | return !empty($this->tokensOrdered); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Whether there were any unknown tokens in the statement. |
|
| 120 | - * |
|
| 121 | - * @return bool |
|
| 122 | - */ |
|
| 118 | + /** |
|
| 119 | + * Whether there were any unknown tokens in the statement. |
|
| 120 | + * |
|
| 121 | + * @return bool |
|
| 122 | + */ |
|
| 123 | 123 | public function hasUnknown() : bool |
| 124 | 124 | { |
| 125 | 125 | $unknown = $this->getUnknown(); |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | return !empty($unknown); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - /** |
|
| 131 | - * Retrieves all unknown content tokens, if any. |
|
| 132 | - * |
|
| 133 | - * @return \Mailcode\Mailcode_Parser_Statement_Tokenizer_Token_Unknown[] |
|
| 134 | - */ |
|
| 130 | + /** |
|
| 131 | + * Retrieves all unknown content tokens, if any. |
|
| 132 | + * |
|
| 133 | + * @return \Mailcode\Mailcode_Parser_Statement_Tokenizer_Token_Unknown[] |
|
| 134 | + */ |
|
| 135 | 135 | public function getUnknown() |
| 136 | 136 | { |
| 137 | 137 | $result = array(); |
@@ -201,13 +201,13 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Registers a token to add in the statement string. |
|
| 206 | - * |
|
| 207 | - * @param string $type |
|
| 208 | - * @param string $matchedText |
|
| 209 | - * @param mixed $subject |
|
| 210 | - */ |
|
| 204 | + /** |
|
| 205 | + * Registers a token to add in the statement string. |
|
| 206 | + * |
|
| 207 | + * @param string $type |
|
| 208 | + * @param string $matchedText |
|
| 209 | + * @param mixed $subject |
|
| 210 | + */ |
|
| 211 | 211 | protected function registerToken(string $type, string $matchedText, $subject=null) : void |
| 212 | 212 | { |
| 213 | 213 | $tokenID = $this->generateID(); |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | return null; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - /** |
|
| 240 | - * Some WYSIWYG editors like using pretty quotes instead |
|
| 241 | - * of the usual double quotes. This simply replaces all |
|
| 242 | - * occurrences with the regular variant. |
|
| 243 | - */ |
|
| 239 | + /** |
|
| 240 | + * Some WYSIWYG editors like using pretty quotes instead |
|
| 241 | + * of the usual double quotes. This simply replaces all |
|
| 242 | + * occurrences with the regular variant. |
|
| 243 | + */ |
|
| 244 | 244 | protected function tokenize_normalize_quotes() : void |
| 245 | 245 | { |
| 246 | 246 | $this->tokenized = str_replace(array('“', '”'), '"', $this->tokenized); |
@@ -329,13 +329,13 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - /** |
|
| 333 | - * Generates a unique alphabet-based ID without numbers |
|
| 334 | - * to use as token name, to avoid conflicts with the |
|
| 335 | - * numbers detection. |
|
| 336 | - * |
|
| 337 | - * @return string |
|
| 338 | - */ |
|
| 332 | + /** |
|
| 333 | + * Generates a unique alphabet-based ID without numbers |
|
| 334 | + * to use as token name, to avoid conflicts with the |
|
| 335 | + * numbers detection. |
|
| 336 | + * |
|
| 337 | + * @return string |
|
| 338 | + */ |
|
| 339 | 339 | protected function generateID() : string |
| 340 | 340 | { |
| 341 | 341 | static $alphas; |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | return $this->getSign(); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Retrieves all known comparison operator signs. |
|
| 35 | - * @return string[] |
|
| 36 | - */ |
|
| 33 | + /** |
|
| 34 | + * Retrieves all known comparison operator signs. |
|
| 35 | + * @return string[] |
|
| 36 | + */ |
|
| 37 | 37 | public static function getComparisonSigns() : array |
| 38 | 38 | { |
| 39 | 39 | return array( |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | ); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Retrieves all known arithmetic operator signs. |
|
| 51 | - * @return string[] |
|
| 52 | - */ |
|
| 49 | + /** |
|
| 50 | + * Retrieves all known arithmetic operator signs. |
|
| 51 | + * @return string[] |
|
| 52 | + */ |
|
| 53 | 53 | public static function getArithmeticSigns() : array |
| 54 | 54 | { |
| 55 | 55 | return array( |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | ); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Whether the operator is comparison related (equals, not equals, smaller, greater...). |
|
| 65 | - * |
|
| 66 | - * @return bool |
|
| 67 | - */ |
|
| 63 | + /** |
|
| 64 | + * Whether the operator is comparison related (equals, not equals, smaller, greater...). |
|
| 65 | + * |
|
| 66 | + * @return bool |
|
| 67 | + */ |
|
| 68 | 68 | public function isComparator() : bool |
| 69 | 69 | { |
| 70 | 70 | return |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | $this->isSmallerOrEquals(); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Whether the operator is calculation related (minus, plus, divide, multiply). |
|
| 81 | - * |
|
| 82 | - * @return bool |
|
| 83 | - */ |
|
| 79 | + /** |
|
| 80 | + * Whether the operator is calculation related (minus, plus, divide, multiply). |
|
| 81 | + * |
|
| 82 | + * @return bool |
|
| 83 | + */ |
|
| 84 | 84 | public function isCalculator() : bool |
| 85 | 85 | { |
| 86 | 86 | return |
@@ -27,19 +27,19 @@ |
||
| 27 | 27 | const VALIDATION_WRONG_KEYWORD = 49702; |
| 28 | 28 | const VALIDATION_VARIABLE_NAME_IS_THE_SAME = 49703; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 32 | - */ |
|
| 30 | + /** |
|
| 31 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 32 | + */ |
|
| 33 | 33 | private $loopVar; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 37 | + */ |
|
| 38 | 38 | private $sourceVar; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 42 | + */ |
|
| 43 | 43 | private $keyword; |
| 44 | 44 | |
| 45 | 45 | public function getName() : string |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | const ERROR_INVALID_COMMAND_CREATED = 50001; |
| 24 | 24 | const ERROR_UNEXPECTED_COMMAND_TYPE = 50002; |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var Mailcode_Factory_CommandSets |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var Mailcode_Factory_CommandSets |
|
| 28 | + */ |
|
| 29 | 29 | private static $commandSets; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Creates a ShowVariable command. |
|
| 33 | - * |
|
| 34 | - * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 35 | - * @return Mailcode_Commands_Command_ShowVariable |
|
| 36 | - */ |
|
| 31 | + /** |
|
| 32 | + * Creates a ShowVariable command. |
|
| 33 | + * |
|
| 34 | + * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 35 | + * @return Mailcode_Commands_Command_ShowVariable |
|
| 36 | + */ |
|
| 37 | 37 | public static function showVar(string $variableName) : Mailcode_Commands_Command_ShowVariable |
| 38 | 38 | { |
| 39 | 39 | return self::$commandSets->show()->showVar($variableName); |
@@ -52,41 +52,41 @@ discard block |
||
| 52 | 52 | return self::$commandSets->show()->showDate($variableName, $formatString); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Creates a ShowSnippet command. |
|
| 57 | - * |
|
| 58 | - * @param string $snippetName A snippet name, with or without the $ sign prepended. |
|
| 59 | - * @return Mailcode_Commands_Command_ShowSnippet |
|
| 60 | - */ |
|
| 55 | + /** |
|
| 56 | + * Creates a ShowSnippet command. |
|
| 57 | + * |
|
| 58 | + * @param string $snippetName A snippet name, with or without the $ sign prepended. |
|
| 59 | + * @return Mailcode_Commands_Command_ShowSnippet |
|
| 60 | + */ |
|
| 61 | 61 | public static function showSnippet(string $snippetName) : Mailcode_Commands_Command_ShowSnippet |
| 62 | 62 | { |
| 63 | 63 | return self::$commandSets->show()->showSnippet($snippetName); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Creates a SetVariable command. |
|
| 68 | - * |
|
| 69 | - * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 70 | - * @param string $value |
|
| 71 | - * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
| 72 | - * @return Mailcode_Commands_Command_SetVariable |
|
| 73 | - * @throws Mailcode_Factory_Exception |
|
| 74 | - * |
|
| 75 | - * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
| 76 | - */ |
|
| 66 | + /** |
|
| 67 | + * Creates a SetVariable command. |
|
| 68 | + * |
|
| 69 | + * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 70 | + * @param string $value |
|
| 71 | + * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
| 72 | + * @return Mailcode_Commands_Command_SetVariable |
|
| 73 | + * @throws Mailcode_Factory_Exception |
|
| 74 | + * |
|
| 75 | + * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
| 76 | + */ |
|
| 77 | 77 | public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
| 78 | 78 | { |
| 79 | 79 | return self::$commandSets->set()->setVar($variableName, $value, $quoteValue); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Like setVar(), but treats the value as a string literal |
|
| 84 | - * and automatically adds quotes to it. |
|
| 85 | - * |
|
| 86 | - * @param string $variableName |
|
| 87 | - * @param string $value |
|
| 88 | - * @return Mailcode_Commands_Command_SetVariable |
|
| 89 | - */ |
|
| 82 | + /** |
|
| 83 | + * Like setVar(), but treats the value as a string literal |
|
| 84 | + * and automatically adds quotes to it. |
|
| 85 | + * |
|
| 86 | + * @param string $variableName |
|
| 87 | + * @param string $value |
|
| 88 | + * @return Mailcode_Commands_Command_SetVariable |
|
| 89 | + */ |
|
| 90 | 90 | public static function setVarString(string $variableName, string $value) : Mailcode_Commands_Command_SetVariable |
| 91 | 91 | { |
| 92 | 92 | return self::$commandSets->set()->setVar($variableName, $value, true); |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | return self::$commandSets->if()->ifContains($variable, array($search), $caseInsensitive); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * Creates if contains command, with several search terms. |
|
| 217 | - * |
|
| 218 | - * @param string $variable |
|
| 219 | - * @param string[] $searchTerms List of search terms. Do not add surrounding quotes. |
|
| 220 | - * @param bool $caseInsensitive |
|
| 221 | - * @return Mailcode_Commands_Command_If_Contains |
|
| 222 | - */ |
|
| 215 | + /** |
|
| 216 | + * Creates if contains command, with several search terms. |
|
| 217 | + * |
|
| 218 | + * @param string $variable |
|
| 219 | + * @param string[] $searchTerms List of search terms. Do not add surrounding quotes. |
|
| 220 | + * @param bool $caseInsensitive |
|
| 221 | + * @return Mailcode_Commands_Command_If_Contains |
|
| 222 | + */ |
|
| 223 | 223 | public static function ifContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
| 224 | 224 | { |
| 225 | 225 | return self::$commandSets->if()->ifContains($variable, $searchTerms, $caseInsensitive); |
@@ -230,14 +230,14 @@ discard block |
||
| 230 | 230 | return self::$commandSets->elseIf()->elseIfContains($variable, array($search), $caseInsensitive); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - /** |
|
| 234 | - * Creates else if contains command, with several search terms. |
|
| 235 | - * |
|
| 236 | - * @param string $variable |
|
| 237 | - * @param string[] $searchTerms List of search terms. Do not add surrounding quotes. |
|
| 238 | - * @param bool $caseInsensitive |
|
| 239 | - * @return Mailcode_Commands_Command_ElseIf_Contains |
|
| 240 | - */ |
|
| 233 | + /** |
|
| 234 | + * Creates else if contains command, with several search terms. |
|
| 235 | + * |
|
| 236 | + * @param string $variable |
|
| 237 | + * @param string[] $searchTerms List of search terms. Do not add surrounding quotes. |
|
| 238 | + * @param bool $caseInsensitive |
|
| 239 | + * @return Mailcode_Commands_Command_ElseIf_Contains |
|
| 240 | + */ |
|
| 241 | 241 | public static function elseIfContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
| 242 | 242 | { |
| 243 | 243 | return self::$commandSets->elseIf()->elseIfContains($variable, $searchTerms, $caseInsensitive); |
@@ -258,34 +258,34 @@ discard block |
||
| 258 | 258 | return self::$commandSets->misc()->for($sourceVariable, $loopVariable); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - /** |
|
| 262 | - * Creates a renderer instance, which can be used to easily |
|
| 263 | - * create and convert commands to strings. |
|
| 264 | - * |
|
| 265 | - * @return Mailcode_Renderer |
|
| 266 | - */ |
|
| 261 | + /** |
|
| 262 | + * Creates a renderer instance, which can be used to easily |
|
| 263 | + * create and convert commands to strings. |
|
| 264 | + * |
|
| 265 | + * @return Mailcode_Renderer |
|
| 266 | + */ |
|
| 267 | 267 | public static function createRenderer() : Mailcode_Renderer |
| 268 | 268 | { |
| 269 | 269 | return new Mailcode_Renderer(); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - /** |
|
| 273 | - * Creates a printer instance, which works like the renderer, |
|
| 274 | - * but outputs the generated strings to standard output. |
|
| 275 | - * |
|
| 276 | - * @return Mailcode_Printer |
|
| 277 | - */ |
|
| 272 | + /** |
|
| 273 | + * Creates a printer instance, which works like the renderer, |
|
| 274 | + * but outputs the generated strings to standard output. |
|
| 275 | + * |
|
| 276 | + * @return Mailcode_Printer |
|
| 277 | + */ |
|
| 278 | 278 | public static function createPrinter() : Mailcode_Printer |
| 279 | 279 | { |
| 280 | 280 | return new Mailcode_Printer(); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - /** |
|
| 284 | - * Gets/creates the global instance of the date format info |
|
| 285 | - * class, used to handle date formatting aspects. |
|
| 286 | - * |
|
| 287 | - * @return Mailcode_Date_FormatInfo |
|
| 288 | - */ |
|
| 283 | + /** |
|
| 284 | + * Gets/creates the global instance of the date format info |
|
| 285 | + * class, used to handle date formatting aspects. |
|
| 286 | + * |
|
| 287 | + * @return Mailcode_Date_FormatInfo |
|
| 288 | + */ |
|
| 289 | 289 | public static function createDateInfo() : Mailcode_Date_FormatInfo |
| 290 | 290 | { |
| 291 | 291 | return Mailcode_Date_FormatInfo::getInstance(); |
@@ -26,51 +26,51 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | class Mailcode |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @var Mailcode_Parser|NULL |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var Mailcode_Parser|NULL |
|
| 31 | + */ |
|
| 32 | 32 | protected $parser = null; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var Mailcode_Commands|NULL |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var Mailcode_Commands|NULL |
|
| 36 | + */ |
|
| 37 | 37 | protected $commands = null; |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var Mailcode_Variables|NULL |
|
| 41 | - */ |
|
| 39 | + /** |
|
| 40 | + * @var Mailcode_Variables|NULL |
|
| 41 | + */ |
|
| 42 | 42 | protected $variables = null; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var Mailcode_Translator|NULL |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var Mailcode_Translator|NULL |
|
| 46 | + */ |
|
| 47 | 47 | protected $translator = null; |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Creates a new mailcode instance. |
|
| 51 | - * @return Mailcode |
|
| 52 | - */ |
|
| 49 | + /** |
|
| 50 | + * Creates a new mailcode instance. |
|
| 51 | + * @return Mailcode |
|
| 52 | + */ |
|
| 53 | 53 | public static function create() : Mailcode |
| 54 | 54 | { |
| 55 | 55 | return new Mailcode(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Parses the string to detect all commands contained within. |
|
| 60 | - * |
|
| 61 | - * @param string $string |
|
| 62 | - * @return Mailcode_Collection |
|
| 63 | - */ |
|
| 58 | + /** |
|
| 59 | + * Parses the string to detect all commands contained within. |
|
| 60 | + * |
|
| 61 | + * @param string $string |
|
| 62 | + * @return Mailcode_Collection |
|
| 63 | + */ |
|
| 64 | 64 | public function parseString(string $string) : Mailcode_Collection |
| 65 | 65 | { |
| 66 | 66 | return $this->getParser()->parseString($string); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Retrieves the string parser instance used to detect commands. |
|
| 71 | - * |
|
| 72 | - * @return Mailcode_Parser |
|
| 73 | - */ |
|
| 69 | + /** |
|
| 70 | + * Retrieves the string parser instance used to detect commands. |
|
| 71 | + * |
|
| 72 | + * @return Mailcode_Parser |
|
| 73 | + */ |
|
| 74 | 74 | public function getParser() : Mailcode_Parser |
| 75 | 75 | { |
| 76 | 76 | if(!isset($this->parser)) |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | return $this->parser; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Retrieves the commands collection, which is used to |
|
| 86 | - * access information on the available commands. |
|
| 87 | - * |
|
| 88 | - * @return Mailcode_Commands |
|
| 89 | - */ |
|
| 84 | + /** |
|
| 85 | + * Retrieves the commands collection, which is used to |
|
| 86 | + * access information on the available commands. |
|
| 87 | + * |
|
| 88 | + * @return Mailcode_Commands |
|
| 89 | + */ |
|
| 90 | 90 | public function getCommands() : Mailcode_Commands |
| 91 | 91 | { |
| 92 | 92 | if(!isset($this->commands)) |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | return new Mailcode_StringContainer($subject); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * Attempts to find all variables in the target string. |
|
| 112 | - * |
|
| 113 | - * @param string $subject |
|
| 114 | - * @return Mailcode_Variables_Collection_Regular |
|
| 115 | - */ |
|
| 110 | + /** |
|
| 111 | + * Attempts to find all variables in the target string. |
|
| 112 | + * |
|
| 113 | + * @param string $subject |
|
| 114 | + * @return Mailcode_Variables_Collection_Regular |
|
| 115 | + */ |
|
| 116 | 116 | public function findVariables(string $subject) : Mailcode_Variables_Collection_Regular |
| 117 | 117 | { |
| 118 | 118 | return $this->createVariables()->parseString($subject); |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | return $this->variables; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * Creates the translator, which can be used to convert commands |
|
| 133 | - * to another supported syntax. |
|
| 134 | - * |
|
| 135 | - * @return Mailcode_Translator |
|
| 136 | - */ |
|
| 131 | + /** |
|
| 132 | + * Creates the translator, which can be used to convert commands |
|
| 133 | + * to another supported syntax. |
|
| 134 | + * |
|
| 135 | + * @return Mailcode_Translator |
|
| 136 | + */ |
|
| 137 | 137 | public function createTranslator() : Mailcode_Translator |
| 138 | 138 | { |
| 139 | 139 | if(!isset($this->translator)) |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | return $this->translator; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * Creates the styler, which can be used to retrieve the |
|
| 149 | - * CSS required to style the highlighted commands in HTML. |
|
| 150 | - * |
|
| 151 | - * @return Mailcode_Styler |
|
| 152 | - */ |
|
| 147 | + /** |
|
| 148 | + * Creates the styler, which can be used to retrieve the |
|
| 149 | + * CSS required to style the highlighted commands in HTML. |
|
| 150 | + * |
|
| 151 | + * @return Mailcode_Styler |
|
| 152 | + */ |
|
| 153 | 153 | public function createStyler() : Mailcode_Styler |
| 154 | 154 | { |
| 155 | 155 | return new Mailcode_Styler(); |