@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $command->getID() |
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | - if(!class_exists($class)) |
|
| 67 | + if (!class_exists($class)) |
|
| 68 | 68 | { |
| 69 | 69 | throw new Mailcode_Translator_Exception( |
| 70 | 70 | sprintf('Unknown command %s in translator', $command->getID()), |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $subject = $safeguard->makeSafe(); |
| 94 | 94 | |
| 95 | - if(!$safeguard->hasPlaceholders()) |
|
| 95 | + if (!$safeguard->hasPlaceholders()) |
|
| 96 | 96 | { |
| 97 | 97 | return $subject; |
| 98 | 98 | } |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $replaces = array(); |
| 103 | 103 | |
| 104 | - foreach($placeholders as $placeholder) |
|
| 104 | + foreach ($placeholders as $placeholder) |
|
| 105 | 105 | { |
| 106 | 106 | $command = $placeholder->getCommand(); |
| 107 | 107 | |
| 108 | 108 | $replaces[$placeholder->getReplacementText()] = $this->translateCommand($command); |
| 109 | 109 | |
| 110 | - if($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
| 110 | + if ($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
| 111 | 111 | { |
| 112 | 112 | $replaces[$command->getContentPlaceholder()] = $command->getContent(); |
| 113 | 113 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $varName = ltrim($command->getVariableName(), '$'); |
| 26 | 26 | |
| 27 | 27 | // Automatically URL escape the variable if it's in an URL. |
| 28 | - if($command->isURLEncoded()) |
|
| 28 | + if ($command->isURLEncoded()) |
|
| 29 | 29 | { |
| 30 | 30 | return sprintf( |
| 31 | 31 | '${esc.url($%s)}', |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if($command->isURLDecoded()) |
|
| 36 | + if ($command->isURLDecoded()) |
|
| 37 | 37 | { |
| 38 | 38 | return sprintf( |
| 39 | 39 | '${esc.unurl($%s)}', |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | // IF type. |
| 40 | 40 | $method = 'translate'.$this->getIfType($command); |
| 41 | 41 | |
| 42 | - if(method_exists($this, $method)) |
|
| 42 | + if (method_exists($this, $method)) |
|
| 43 | 43 | { |
| 44 | 44 | return strval($this->$method($command)); |
| 45 | 45 | } |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $keywords = $command->getLogicKeywords()->getKeywords(); |
| 55 | 55 | |
| 56 | - foreach($keywords as $keyword) |
|
| 56 | + foreach ($keywords as $keyword) |
|
| 57 | 57 | { |
| 58 | 58 | $keyCommand = $keyword->getCommand(); |
| 59 | 59 | |
| 60 | - if($keyCommand instanceof Mailcode_Commands_IfBase) |
|
| 60 | + if ($keyCommand instanceof Mailcode_Commands_IfBase) |
|
| 61 | 61 | { |
| 62 | 62 | $body .= ' '.$this->getSign($keyword).' '.$this->translateBody($keyCommand); |
| 63 | 63 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | protected function getSign(Mailcode_Commands_LogicKeywords_Keyword $keyword) : string |
| 82 | 82 | { |
| 83 | - switch($keyword->getName()) |
|
| 83 | + switch ($keyword->getName()) |
|
| 84 | 84 | { |
| 85 | 85 | case 'and': |
| 86 | 86 | return '&&'; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $sign = ''; |
| 119 | 119 | |
| 120 | - if($notEmpty) |
|
| 120 | + if ($notEmpty) |
|
| 121 | 121 | { |
| 122 | 122 | $sign = '!'; |
| 123 | 123 | } |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $params = $command->getParams(); |
| 135 | 135 | |
| 136 | - if(!$params) |
|
| 136 | + if (!$params) |
|
| 137 | 137 | { |
| 138 | 138 | return ''; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if($command->hasFreeformParameters()) |
|
| 141 | + if ($command->hasFreeformParameters()) |
|
| 142 | 142 | { |
| 143 | 143 | return $params->getStatementString(); |
| 144 | 144 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $test = strtolower(trim($value, '"')); |
| 152 | 152 | $fullName = $variable->getFullName(); |
| 153 | 153 | |
| 154 | - if(in_array($test, array('true', 'false'))) |
|
| 154 | + if (in_array($test, array('true', 'false'))) |
|
| 155 | 155 | { |
| 156 | 156 | $fullName .= '.toLowerCase()'; |
| 157 | 157 | $value = '"'.$test.'"'; |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | $varName = $variable->getFullName(); |
| 179 | 179 | |
| 180 | 180 | $opts = 's'; |
| 181 | - if($caseSensitive) |
|
| 181 | + if ($caseSensitive) |
|
| 182 | 182 | { |
| 183 | 183 | $opts = 'is'; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - foreach($searchTerms as $token) |
|
| 186 | + foreach ($searchTerms as $token) |
|
| 187 | 187 | { |
| 188 | 188 | $parts[] = sprintf( |
| 189 | 189 | '%s.matches("(?%s)%s")', |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | protected function _translateSearch(string $mode, Mailcode_Variables_Variable $variable, bool $caseSensitive, string $searchTerm) : string |
| 200 | 200 | { |
| 201 | 201 | $method = $mode.'With'; |
| 202 | - if($caseSensitive) |
|
| 202 | + if ($caseSensitive) |
|
| 203 | 203 | { |
| 204 | 204 | $method = $mode.'WithIgnoreCase'; |
| 205 | 205 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $varName |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - if($command->isURLEncoded()) |
|
| 37 | + if ($command->isURLEncoded()) |
|
| 38 | 38 | { |
| 39 | 39 | return sprintf( |
| 40 | 40 | '${esc.url($%s)}', |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if($command->isURLDecoded()) |
|
| 45 | + if ($command->isURLDecoded()) |
|
| 46 | 46 | { |
| 47 | 47 | return sprintf( |
| 48 | 48 | '${esc.unurl($%s)}', |
@@ -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. |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function createSyntax(string $name) : Mailcode_Translator_Syntax |
| 34 | 34 | { |
| 35 | - if($this->syntaxExists($name)) |
|
| 35 | + if ($this->syntaxExists($name)) |
|
| 36 | 36 | { |
| 37 | 37 | return new Mailcode_Translator_Syntax($name); |
| 38 | 38 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $names = $this->getSyntaxNames(); |
| 60 | 60 | $result = array(); |
| 61 | 61 | |
| 62 | - foreach($names as $name) |
|
| 62 | + foreach ($names as $name) |
|
| 63 | 63 | { |
| 64 | 64 | $result[] = $this->createSyntax($name); |
| 65 | 65 | } |
@@ -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 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected $freeform = false; |
| 53 | 53 | |
| 54 | - public function __construct(string $statement, bool $freeform=false) |
|
| 54 | + public function __construct(string $statement, bool $freeform = false) |
|
| 55 | 55 | { |
| 56 | 56 | $this->statement = $statement; |
| 57 | 57 | $this->result = new OperationResult($this); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function getInfo() : Mailcode_Parser_Statement_Info |
| 82 | 82 | { |
| 83 | - if($this->info instanceof Mailcode_Parser_Statement_Info) |
|
| 83 | + if ($this->info instanceof Mailcode_Parser_Statement_Info) |
|
| 84 | 84 | { |
| 85 | 85 | return $this->info; |
| 86 | 86 | } |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | protected function validate() : void |
| 94 | 94 | { |
| 95 | - if($this->freeform) |
|
| 95 | + if ($this->freeform) |
|
| 96 | 96 | { |
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if(!$this->tokenizer->hasTokens()) |
|
| 100 | + if (!$this->tokenizer->hasTokens()) |
|
| 101 | 101 | { |
| 102 | 102 | $this->result->makeError( |
| 103 | 103 | t('Empty statement'), |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $unknown = $this->tokenizer->getFirstUnknown(); |
| 111 | 111 | |
| 112 | - if($unknown) |
|
| 112 | + if ($unknown) |
|
| 113 | 113 | { |
| 114 | 114 | $this->result->makeError( |
| 115 | 115 | t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')', |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $operand = $this->getOperandByIndex(1); |
| 49 | 49 | $value = $this->getTokenByIndex(2); |
| 50 | 50 | |
| 51 | - if($variable && $operand && $value && $operand->isAssignment()) |
|
| 51 | + if ($variable && $operand && $value && $operand->isAssignment()) |
|
| 52 | 52 | { |
| 53 | 53 | return true; |
| 54 | 54 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $operand = $this->getOperandByIndex(1); |
| 68 | 68 | $value = $this->getTokenByIndex(2); |
| 69 | 69 | |
| 70 | - if($variable && $operand && $value && $operand->isComparator()) |
|
| 70 | + if ($variable && $operand && $value && $operand->isComparator()) |
|
| 71 | 71 | { |
| 72 | 72 | return true; |
| 73 | 73 | } |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $result = array(); |
| 86 | 86 | |
| 87 | - foreach($this->tokens as $token) |
|
| 87 | + foreach ($this->tokens as $token) |
|
| 88 | 88 | { |
| 89 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 89 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 90 | 90 | { |
| 91 | 91 | $result[] = $token->getVariable(); |
| 92 | 92 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $token = $this->getTokenByIndex($index); |
| 109 | 109 | |
| 110 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 110 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 111 | 111 | { |
| 112 | 112 | return $token; |
| 113 | 113 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $token = $this->getTokenByIndex($index); |
| 129 | 129 | |
| 130 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 130 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 131 | 131 | { |
| 132 | 132 | return $token; |
| 133 | 133 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | $token = $this->getTokenByIndex($index); |
| 149 | 149 | |
| 150 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 150 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 151 | 151 | { |
| 152 | 152 | return $token; |
| 153 | 153 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $token = $this->getTokenByIndex($index); |
| 169 | 169 | |
| 170 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 170 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 171 | 171 | { |
| 172 | 172 | return $token; |
| 173 | 173 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public function getTokenByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token |
| 187 | 187 | { |
| 188 | - if(isset($this->tokens[$index])) |
|
| 188 | + if (isset($this->tokens[$index])) |
|
| 189 | 189 | { |
| 190 | 190 | return $this->tokens[$index]; |
| 191 | 191 | } |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | { |
| 216 | 216 | $result = array(); |
| 217 | 217 | |
| 218 | - foreach($this->tokens as $token) |
|
| 218 | + foreach ($this->tokens as $token) |
|
| 219 | 219 | { |
| 220 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 220 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 221 | 221 | { |
| 222 | 222 | $result[] = $token; |
| 223 | 223 | } |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | { |
| 239 | 239 | $result = array(); |
| 240 | 240 | |
| 241 | - foreach($this->tokens as $token) |
|
| 241 | + foreach ($this->tokens as $token) |
|
| 242 | 242 | { |
| 243 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 243 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 244 | 244 | { |
| 245 | 245 | $result[] = $token; |
| 246 | 246 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function setKeywordEnabled(string $keyword, bool $enabled) : Mailcode_Parser_Statement_Info |
| 261 | 261 | { |
| 262 | - if($enabled) |
|
| 262 | + if ($enabled) |
|
| 263 | 263 | { |
| 264 | 264 | return $this->addKeyword($keyword); |
| 265 | 265 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | { |
| 279 | 279 | $keyword = rtrim($keyword, ':').':'; |
| 280 | 280 | |
| 281 | - if(!$this->hasKeyword($keyword)) |
|
| 281 | + if (!$this->hasKeyword($keyword)) |
|
| 282 | 282 | { |
| 283 | 283 | $this->tokenizer->appendKeyword($keyword); |
| 284 | 284 | $this->tokens = $this->tokenizer->getTokens(); |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | foreach ($keywords as $kw) |
| 327 | 327 | { |
| 328 | - if($kw->getKeyword() === $keyword) |
|
| 328 | + if ($kw->getKeyword() === $keyword) |
|
| 329 | 329 | { |
| 330 | 330 | return true; |
| 331 | 331 | } |
@@ -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; |