@@ -31,19 +31,19 @@ |
||
| 31 | 31 | const VALIDATION_VARIABLE_NAME_WITH_DOT = 49704; |
| 32 | 32 | const VALIDATION_LOOP_VARIABLE_NAME_WITH_DOT = 49705; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 36 | + */ |
|
| 37 | 37 | private $loopVar; |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 41 | - */ |
|
| 39 | + /** |
|
| 40 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 41 | + */ |
|
| 42 | 42 | private $sourceVar; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 46 | + */ |
|
| 47 | 47 | private $keyword; |
| 48 | 48 | |
| 49 | 49 | public function getName() : string |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | public function getSourceVariable() : Mailcode_Variables_Variable |
| 101 | 101 | { |
| 102 | - if(isset($this->sourceVar)) |
|
| 102 | + if (isset($this->sourceVar)) |
|
| 103 | 103 | { |
| 104 | 104 | return $this->sourceVar->getVariable(); |
| 105 | 105 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | public function getLoopVariable() : Mailcode_Variables_Variable |
| 115 | 115 | { |
| 116 | - if(isset($this->loopVar)) |
|
| 116 | + if (isset($this->loopVar)) |
|
| 117 | 117 | { |
| 118 | 118 | return $this->loopVar->getVariable(); |
| 119 | 119 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $this->keyword = $info->getKeywordByIndex(1); |
| 134 | 134 | $this->sourceVar = $info->getVariableByIndex(2); |
| 135 | 135 | |
| 136 | - if(!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
| 136 | + if (!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
| 137 | 137 | { |
| 138 | 138 | $this->validationResult->makeError( |
| 139 | 139 | t('Not a valid for loop.').' '.t('Is the %1$s keyword missing?', 'in:'), |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | protected function validateSyntax_keyword() : void |
| 148 | 148 | { |
| 149 | - if($this->keyword->isForIn()) |
|
| 149 | + if ($this->keyword->isForIn()) |
|
| 150 | 150 | { |
| 151 | 151 | return; |
| 152 | 152 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | protected function validateSyntax_variable_names() : void |
| 161 | 161 | { |
| 162 | - if($this->sourceVar->getVariable()->getFullName() !== $this->loopVar->getVariable()->getFullName()) |
|
| 162 | + if ($this->sourceVar->getVariable()->getFullName() !== $this->loopVar->getVariable()->getFullName()) |
|
| 163 | 163 | { |
| 164 | 164 | return; |
| 165 | 165 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $parts = explode('.', $name); |
| 178 | 178 | |
| 179 | - if(count($parts) === 1) { |
|
| 179 | + if (count($parts) === 1) { |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | $parts = explode('.', $name); |
| 195 | 195 | |
| 196 | - if(count($parts) === 1) { |
|
| 196 | + if (count($parts) === 1) { |
|
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | 199 | |
@@ -56,23 +56,23 @@ |
||
| 56 | 56 | |
| 57 | 57 | private function analyzeURL(string $url) : void |
| 58 | 58 | { |
| 59 | - if(stristr($url, 'tel:') !== false) |
|
| 59 | + if (stristr($url, 'tel:') !== false) |
|
| 60 | 60 | { |
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $placeholders = $this->safeguard->getPlaceholders(); |
| 65 | 65 | |
| 66 | - foreach($placeholders as $placeholder) |
|
| 66 | + foreach ($placeholders as $placeholder) |
|
| 67 | 67 | { |
| 68 | 68 | $command = $placeholder->getCommand(); |
| 69 | 69 | |
| 70 | - if(!$command->supportsURLEncoding()) |
|
| 70 | + if (!$command->supportsURLEncoding()) |
|
| 71 | 71 | { |
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if(strstr($url, $placeholder->getReplacementText()) !== false && !$command->isURLDecoded()) |
|
| 75 | + if (strstr($url, $placeholder->getReplacementText()) !== false && !$command->isURLDecoded()) |
|
| 76 | 76 | { |
| 77 | 77 | $command->setURLEncoding(true); |
| 78 | 78 | break; |
@@ -23,25 +23,25 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | trait Mailcode_Traits_Formatting_HTMLHighlighting |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * Stored this way so we can use isset() instead |
|
| 28 | - * of using in_array, which is some magnitudes slower. |
|
| 29 | - * The boolean value is not used otherwise. |
|
| 30 | - * |
|
| 31 | - * @var array<string,bool> |
|
| 32 | - */ |
|
| 26 | + /** |
|
| 27 | + * Stored this way so we can use isset() instead |
|
| 28 | + * of using in_array, which is some magnitudes slower. |
|
| 29 | + * The boolean value is not used otherwise. |
|
| 30 | + * |
|
| 31 | + * @var array<string,bool> |
|
| 32 | + */ |
|
| 33 | 33 | private $excludeTags = array( |
| 34 | 34 | 'style' => true, // NOTE: style tags are excluded natively on the parser level. |
| 35 | 35 | 'script' => true |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Adds an HTML tag name to the list of tags within which |
|
| 40 | - * commands may not be highlighted. |
|
| 41 | - * |
|
| 42 | - * @param string $tagName Case insensitive. |
|
| 43 | - * @return $this |
|
| 44 | - */ |
|
| 38 | + /** |
|
| 39 | + * Adds an HTML tag name to the list of tags within which |
|
| 40 | + * commands may not be highlighted. |
|
| 41 | + * |
|
| 42 | + * @param string $tagName Case insensitive. |
|
| 43 | + * @return $this |
|
| 44 | + */ |
|
| 45 | 45 | public function excludeTag(string $tagName) |
| 46 | 46 | { |
| 47 | 47 | $tagName = strtolower($tagName); |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | return $this; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Adds several exluded tag names at once. |
|
| 56 | - * |
|
| 57 | - * @param string[] $tagNames |
|
| 58 | - * @return $this |
|
| 59 | - */ |
|
| 54 | + /** |
|
| 55 | + * Adds several exluded tag names at once. |
|
| 56 | + * |
|
| 57 | + * @param string[] $tagNames |
|
| 58 | + * @return $this |
|
| 59 | + */ |
|
| 60 | 60 | public function excludeTags(array $tagNames) |
| 61 | 61 | { |
| 62 | 62 | foreach($tagNames as $tagName) |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Whether the specified tag name is in the exlusion list. |
|
| 72 | - * |
|
| 73 | - * @param string $tagName |
|
| 74 | - * @return bool |
|
| 75 | - */ |
|
| 70 | + /** |
|
| 71 | + * Whether the specified tag name is in the exlusion list. |
|
| 72 | + * |
|
| 73 | + * @param string $tagName |
|
| 74 | + * @return bool |
|
| 75 | + */ |
|
| 76 | 76 | public function isTagExcluded(string $tagName) : bool |
| 77 | 77 | { |
| 78 | 78 | $tagName = strtolower($tagName); |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | */ |
| 60 | 60 | public function excludeTags(array $tagNames) |
| 61 | 61 | { |
| 62 | - foreach($tagNames as $tagName) |
|
| 62 | + foreach ($tagNames as $tagName) |
|
| 63 | 63 | { |
| 64 | 64 | $this->excludeTag((string)$tagName); |
| 65 | 65 | } |
@@ -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 |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $this->caseInsensitive = $val->isValid(); |
| 44 | 44 | |
| 45 | - if($val->isValid()) |
|
| 45 | + if ($val->isValid()) |
|
| 46 | 46 | { |
| 47 | 47 | $this->regexToken = $val->getToken(); |
| 48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function getCaseToken() : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
| 57 | 57 | { |
| 58 | - if($this->regexToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 58 | + if ($this->regexToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 59 | 59 | { |
| 60 | 60 | return $this->regexToken; |
| 61 | 61 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $this->regexEnabled = $val->isValid(); |
| 44 | 44 | |
| 45 | - if($val->isValid()) |
|
| 45 | + if ($val->isValid()) |
|
| 46 | 46 | { |
| 47 | 47 | $this->regexToken = $val->getToken(); |
| 48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function getRegexToken() : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
| 57 | 57 | { |
| 58 | - if($this->regexToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 58 | + if ($this->regexToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 59 | 59 | { |
| 60 | 60 | return $this->regexToken; |
| 61 | 61 | } |
@@ -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( |
@@ -74,11 +74,11 @@ |
||
| 74 | 74 | return new Mailcode_Parser_Statement_Validator_Type_Value($this->statement); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function createOperand(string $sign='') : Mailcode_Parser_Statement_Validator_Type_Operand |
|
| 77 | + public function createOperand(string $sign = '') : Mailcode_Parser_Statement_Validator_Type_Operand |
|
| 78 | 78 | { |
| 79 | 79 | $validate = new Mailcode_Parser_Statement_Validator_Type_Operand($this->statement); |
| 80 | 80 | |
| 81 | - if(!empty($sign)) |
|
| 81 | + if (!empty($sign)) |
|
| 82 | 82 | { |
| 83 | 83 | $validate->setOperandSign($sign); |
| 84 | 84 | } |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | const ERROR_CANNOT_RETRIEVE_FIRST_ERROR = 52301; |
| 26 | 26 | const ERROR_CANNOT_MODIFY_FINALIZED = 52302; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var Mailcode_Commands_Command[] |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var Mailcode_Commands_Command[] |
|
| 30 | + */ |
|
| 31 | 31 | protected $commands = array(); |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected $errors = array(); |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @var OperationResult|NULL |
|
| 40 | - */ |
|
| 38 | + /** |
|
| 39 | + * @var OperationResult|NULL |
|
| 40 | + */ |
|
| 41 | 41 | protected $validationResult; |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -77,21 +77,21 @@ discard block |
||
| 77 | 77 | return $this; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Whether there are any commands in the collection. |
|
| 82 | - * |
|
| 83 | - * @return bool |
|
| 84 | - */ |
|
| 80 | + /** |
|
| 81 | + * Whether there are any commands in the collection. |
|
| 82 | + * |
|
| 83 | + * @return bool |
|
| 84 | + */ |
|
| 85 | 85 | public function hasCommands() : bool |
| 86 | 86 | { |
| 87 | 87 | return !empty($this->commands); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Counts the amount of commands in the collection. |
|
| 92 | - * |
|
| 93 | - * @return int |
|
| 94 | - */ |
|
| 90 | + /** |
|
| 91 | + * Counts the amount of commands in the collection. |
|
| 92 | + * |
|
| 93 | + * @return int |
|
| 94 | + */ |
|
| 95 | 95 | public function countCommands() : int |
| 96 | 96 | { |
| 97 | 97 | return count($this->commands); |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | $this->commands = $keep; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * @return Mailcode_Collection_Error[] |
|
| 134 | - */ |
|
| 132 | + /** |
|
| 133 | + * @return Mailcode_Collection_Error[] |
|
| 134 | + */ |
|
| 135 | 135 | public function getErrors() |
| 136 | 136 | { |
| 137 | 137 | $result = $this->getValidationResult(); |
@@ -173,12 +173,12 @@ discard block |
||
| 173 | 173 | return empty($errors); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - /** |
|
| 177 | - * Retrieves all commands that were detected, in the exact order |
|
| 178 | - * they were found. |
|
| 179 | - * |
|
| 180 | - * @return Mailcode_Commands_Command[] |
|
| 181 | - */ |
|
| 176 | + /** |
|
| 177 | + * Retrieves all commands that were detected, in the exact order |
|
| 178 | + * they were found. |
|
| 179 | + * |
|
| 180 | + * @return Mailcode_Commands_Command[] |
|
| 181 | + */ |
|
| 182 | 182 | public function getCommands() |
| 183 | 183 | { |
| 184 | 184 | $this->validate(); |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
| 332 | - * Retrieves only show variable commands in the collection, if any. |
|
| 333 | - * |
|
| 334 | - * @return Mailcode_Commands_Command_ShowVariable[] |
|
| 335 | - */ |
|
| 332 | + * Retrieves only show variable commands in the collection, if any. |
|
| 333 | + * |
|
| 334 | + * @return Mailcode_Commands_Command_ShowVariable[] |
|
| 335 | + */ |
|
| 336 | 336 | public function getShowVariableCommands(): array |
| 337 | 337 | { |
| 338 | 338 | return $this->getCommandsByClass(Mailcode_Commands_Command_ShowVariable::class); |
@@ -346,11 +346,11 @@ discard block |
||
| 346 | 346 | return $this->getCommandsByClass(Mailcode_Commands_Command_For::class); |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | - /** |
|
| 350 | - * Retrieves only show date commands in the collection, if any. |
|
| 351 | - * |
|
| 352 | - * @return Mailcode_Commands_Command_ShowDate[] |
|
| 353 | - */ |
|
| 349 | + /** |
|
| 350 | + * Retrieves only show date commands in the collection, if any. |
|
| 351 | + * |
|
| 352 | + * @return Mailcode_Commands_Command_ShowDate[] |
|
| 353 | + */ |
|
| 354 | 354 | public function getShowDateCommands() : array |
| 355 | 355 | { |
| 356 | 356 | return $this->getCommandsByClass(Mailcode_Commands_Command_ShowDate::class); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function addCommand(Mailcode_Commands_Command $command) : Mailcode_Collection |
| 61 | 61 | { |
| 62 | - if($this->finalized) |
|
| 62 | + if ($this->finalized) |
|
| 63 | 63 | { |
| 64 | 64 | throw new Mailcode_Exception( |
| 65 | 65 | 'Cannot add commands to a finalized collection', |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $keep = array(); |
| 120 | 120 | |
| 121 | - foreach($this->commands as $existing) |
|
| 121 | + foreach ($this->commands as $existing) |
|
| 122 | 122 | { |
| 123 | - if($existing !== $command) |
|
| 123 | + if ($existing !== $command) |
|
| 124 | 124 | { |
| 125 | 125 | $keep[] = $existing; |
| 126 | 126 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | $errors = $this->errors; |
| 140 | 140 | |
| 141 | - if(!$result->isValid()) |
|
| 141 | + if (!$result->isValid()) |
|
| 142 | 142 | { |
| 143 | 143 | $errors[] = new Mailcode_Collection_Error_Message( |
| 144 | 144 | '', |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | $errors = $this->getErrors(); |
| 156 | 156 | |
| 157 | - if(!empty($errors)) |
|
| 157 | + if (!empty($errors)) |
|
| 158 | 158 | { |
| 159 | 159 | return array_shift($errors); |
| 160 | 160 | } |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | $hashes = array(); |
| 203 | 203 | |
| 204 | - foreach($this->commands as $command) |
|
| 204 | + foreach ($this->commands as $command) |
|
| 205 | 205 | { |
| 206 | 206 | $hash = $command->getHash(); |
| 207 | 207 | |
| 208 | - if(!isset($hashes[$hash])) |
|
| 208 | + if (!isset($hashes[$hash])) |
|
| 209 | 209 | { |
| 210 | 210 | $hashes[$hash] = $command; |
| 211 | 211 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | public function addCommands(array $commands) : Mailcode_Collection |
| 225 | 225 | { |
| 226 | - foreach($commands as $command) |
|
| 226 | + foreach ($commands as $command) |
|
| 227 | 227 | { |
| 228 | 228 | $this->addCommand($command); |
| 229 | 229 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | $collection = new Mailcode_Variables_Collection_Regular(); |
| 248 | 248 | |
| 249 | - foreach($this->commands as $command) |
|
| 249 | + foreach ($this->commands as $command) |
|
| 250 | 250 | { |
| 251 | 251 | $collection->mergeWith($command->getVariables()); |
| 252 | 252 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | private function validate() : void |
| 276 | 276 | { |
| 277 | - if(isset($this->validationResult) || $this->validating) |
|
| 277 | + if (isset($this->validationResult) || $this->validating) |
|
| 278 | 278 | { |
| 279 | 279 | return; |
| 280 | 280 | } |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | $errors = $this->getErrors(); |
| 296 | 296 | |
| 297 | - foreach($errors as $error) |
|
| 297 | + foreach ($errors as $error) |
|
| 298 | 298 | { |
| 299 | - if($error->getCode() === $code) |
|
| 299 | + if ($error->getCode() === $code) |
|
| 300 | 300 | { |
| 301 | 301 | return true; |
| 302 | 302 | } |
@@ -364,9 +364,9 @@ discard block |
||
| 364 | 364 | { |
| 365 | 365 | $result = array(); |
| 366 | 366 | |
| 367 | - foreach($this->commands as $command) |
|
| 367 | + foreach ($this->commands as $command) |
|
| 368 | 368 | { |
| 369 | - if($command instanceof $className) |
|
| 369 | + if ($command instanceof $className) |
|
| 370 | 370 | { |
| 371 | 371 | $result[] = $command; |
| 372 | 372 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | { |
| 380 | 380 | $commands = $this->getCommands(); |
| 381 | 381 | |
| 382 | - if(!empty($commands)) |
|
| 382 | + if (!empty($commands)) |
|
| 383 | 383 | { |
| 384 | 384 | return array_shift($commands); |
| 385 | 385 | } |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | private function validateNesting() : void |
| 403 | 403 | { |
| 404 | - foreach($this->commands as $command) |
|
| 404 | + foreach ($this->commands as $command) |
|
| 405 | 405 | { |
| 406 | 406 | $command->validateNesting(); |
| 407 | 407 | |
| 408 | - if(!$command->isValid()) { |
|
| 408 | + if (!$command->isValid()) { |
|
| 409 | 409 | $this->addInvalidCommand($command); |
| 410 | 410 | } |
| 411 | 411 | } |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class Mailcode_Factory_CommandSets_Set_If extends Mailcode_Factory_CommandSets_IfBase |
| 22 | 22 | { |
| 23 | - public function if(string $condition, string $type='') : Mailcode_Commands_Command_If |
|
| 23 | + public function if (string $condition, string $type = '') : Mailcode_Commands_Command_If |
|
| 24 | 24 | { |
| 25 | 25 | $command = $this->instantiator->buildIf('If', $condition, $type); |
| 26 | 26 | |
| 27 | - if($command instanceof Mailcode_Commands_Command_If) |
|
| 27 | + if ($command instanceof Mailcode_Commands_Command_If) |
|
| 28 | 28 | { |
| 29 | 29 | return $command; |
| 30 | 30 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | throw $this->instantiator->exceptionUnexpectedType('If', $command); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function var(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
| 35 | + public function var(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
| 36 | 36 | { |
| 37 | 37 | $command = $this->instantiator->buildIfVar('If', $variable, $operand, $value, $quoteValue); |
| 38 | 38 | |
| 39 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 39 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 40 | 40 | { |
| 41 | 41 | return $command; |
| 42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $command = $this->instantiator->buildIfVar('If', $variable, $operand, $value, true); |
| 50 | 50 | |
| 51 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 51 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 52 | 52 | { |
| 53 | 53 | return $command; |
| 54 | 54 | } |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | throw $this->instantiator->exceptionUnexpectedType('IfVarString', $command); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function varEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
| 59 | + public function varEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
| 60 | 60 | { |
| 61 | 61 | $command = $this->instantiator->buildIfVar('If', $variable, '==', $value, $quoteValue); |
| 62 | 62 | |
| 63 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 63 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 64 | 64 | { |
| 65 | 65 | return $command; |
| 66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $command = $this->instantiator->buildIfVar('If', $variable, '==', $value, true); |
| 74 | 74 | |
| 75 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 75 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 76 | 76 | { |
| 77 | 77 | return $command; |
| 78 | 78 | } |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | throw $this->instantiator->exceptionUnexpectedType('IfarEqualsString', $command); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function varNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
| 83 | + public function varNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
| 84 | 84 | { |
| 85 | 85 | $command = $this->instantiator->buildIfVar('If', $variable, '!=', $value, $quoteValue); |
| 86 | 86 | |
| 87 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 87 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 88 | 88 | { |
| 89 | 89 | return $command; |
| 90 | 90 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | $command = $this->instantiator->buildIfVar('If', $variable, '!=', $value, true); |
| 98 | 98 | |
| 99 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 99 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 100 | 100 | { |
| 101 | 101 | return $command; |
| 102 | 102 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $command = $this->instantiator->buildIfEmpty('If', $variable); |
| 110 | 110 | |
| 111 | - if($command instanceof Mailcode_Commands_Command_If_Empty) |
|
| 111 | + if ($command instanceof Mailcode_Commands_Command_If_Empty) |
|
| 112 | 112 | { |
| 113 | 113 | return $command; |
| 114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $command = $this->instantiator->buildIfNotEmpty('If', $variable); |
| 122 | 122 | |
| 123 | - if($command instanceof Mailcode_Commands_Command_If_NotEmpty) |
|
| 123 | + if ($command instanceof Mailcode_Commands_Command_If_NotEmpty) |
|
| 124 | 124 | { |
| 125 | 125 | return $command; |
| 126 | 126 | } |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | * @return Mailcode_Commands_Command_If_Contains |
| 136 | 136 | * @throws Mailcode_Factory_Exception |
| 137 | 137 | */ |
| 138 | - public function contains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
|
| 138 | + public function contains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains |
|
| 139 | 139 | { |
| 140 | 140 | $command = $this->instantiator->buildIfContains('If', $variable, $searchTerms, $caseInsensitive); |
| 141 | 141 | |
| 142 | - if($command instanceof Mailcode_Commands_Command_If_Contains) |
|
| 142 | + if ($command instanceof Mailcode_Commands_Command_If_Contains) |
|
| 143 | 143 | { |
| 144 | 144 | return $command; |
| 145 | 145 | } |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | * @return Mailcode_Commands_Command_If_NotContains |
| 155 | 155 | * @throws Mailcode_Factory_Exception |
| 156 | 156 | */ |
| 157 | - public function notContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_NotContains |
|
| 157 | + public function notContains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_NotContains |
|
| 158 | 158 | { |
| 159 | 159 | $command = $this->instantiator->buildIfNotContains('If', $variable, $searchTerms, $caseInsensitive); |
| 160 | 160 | |
| 161 | - if($command instanceof Mailcode_Commands_Command_If_NotContains) |
|
| 161 | + if ($command instanceof Mailcode_Commands_Command_If_NotContains) |
|
| 162 | 162 | { |
| 163 | 163 | return $command; |
| 164 | 164 | } |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | * @return Mailcode_Commands_Command_If_ListContains |
| 175 | 175 | * @throws Mailcode_Factory_Exception |
| 176 | 176 | */ |
| 177 | - public function listContains(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListContains |
|
| 177 | + public function listContains(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListContains |
|
| 178 | 178 | { |
| 179 | 179 | $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-contains'); |
| 180 | 180 | |
| 181 | - if($command instanceof Mailcode_Commands_Command_If_ListContains) |
|
| 181 | + if ($command instanceof Mailcode_Commands_Command_If_ListContains) |
|
| 182 | 182 | { |
| 183 | 183 | return $command; |
| 184 | 184 | } |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | * @return Mailcode_Commands_Command_If_ListEquals |
| 194 | 194 | * @throws Mailcode_Factory_Exception |
| 195 | 195 | */ |
| 196 | - public function listEquals(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_ListEquals |
|
| 196 | + public function listEquals(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_ListEquals |
|
| 197 | 197 | { |
| 198 | 198 | $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, false, 'list-equals'); |
| 199 | 199 | |
| 200 | - if($command instanceof Mailcode_Commands_Command_If_ListEquals) |
|
| 200 | + if ($command instanceof Mailcode_Commands_Command_If_ListEquals) |
|
| 201 | 201 | { |
| 202 | 202 | return $command; |
| 203 | 203 | } |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | * @return Mailcode_Commands_Command_If_ListNotContains |
| 214 | 214 | * @throws Mailcode_Factory_Exception |
| 215 | 215 | */ |
| 216 | - public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListNotContains |
|
| 216 | + public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListNotContains |
|
| 217 | 217 | { |
| 218 | 218 | $command = $this->instantiator->buildIfListNotContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled); |
| 219 | 219 | |
| 220 | - if($command instanceof Mailcode_Commands_Command_If_ListNotContains) |
|
| 220 | + if ($command instanceof Mailcode_Commands_Command_If_ListNotContains) |
|
| 221 | 221 | { |
| 222 | 222 | return $command; |
| 223 | 223 | } |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | * @return Mailcode_Commands_Command_If_ListBeginsWith |
| 234 | 234 | * @throws Mailcode_Factory_Exception |
| 235 | 235 | */ |
| 236 | - public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListBeginsWith |
|
| 236 | + public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListBeginsWith |
|
| 237 | 237 | { |
| 238 | - $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled,'list-begins-with'); |
|
| 238 | + $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-begins-with'); |
|
| 239 | 239 | |
| 240 | - if($command instanceof Mailcode_Commands_Command_If_ListBeginsWith) |
|
| 240 | + if ($command instanceof Mailcode_Commands_Command_If_ListBeginsWith) |
|
| 241 | 241 | { |
| 242 | 242 | return $command; |
| 243 | 243 | } |
@@ -253,11 +253,11 @@ discard block |
||
| 253 | 253 | * @return Mailcode_Commands_Command_If_ListEndsWith |
| 254 | 254 | * @throws Mailcode_Factory_Exception |
| 255 | 255 | */ |
| 256 | - public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListEndsWith |
|
| 256 | + public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListEndsWith |
|
| 257 | 257 | { |
| 258 | - $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled,'list-ends-with'); |
|
| 258 | + $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-ends-with'); |
|
| 259 | 259 | |
| 260 | - if($command instanceof Mailcode_Commands_Command_If_ListEndsWith) |
|
| 260 | + if ($command instanceof Mailcode_Commands_Command_If_ListEndsWith) |
|
| 261 | 261 | { |
| 262 | 262 | return $command; |
| 263 | 263 | } |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | throw $this->instantiator->exceptionUnexpectedType('IfListEndsWith', $command); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - public function beginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_BeginsWith |
|
| 268 | + public function beginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_BeginsWith |
|
| 269 | 269 | { |
| 270 | 270 | $command = $this->instantiator->buildIfBeginsWith('If', $variable, $search, $caseInsensitive); |
| 271 | 271 | |
| 272 | - if($command instanceof Mailcode_Commands_Command_If_BeginsWith) |
|
| 272 | + if ($command instanceof Mailcode_Commands_Command_If_BeginsWith) |
|
| 273 | 273 | { |
| 274 | 274 | return $command; |
| 275 | 275 | } |
@@ -277,11 +277,11 @@ discard block |
||
| 277 | 277 | throw $this->instantiator->exceptionUnexpectedType('IfBeginsWith', $command); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - public function endsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_EndsWith |
|
| 280 | + public function endsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_EndsWith |
|
| 281 | 281 | { |
| 282 | 282 | $command = $this->instantiator->buildIfEndsWith('If', $variable, $search, $caseInsensitive); |
| 283 | 283 | |
| 284 | - if($command instanceof Mailcode_Commands_Command_If_EndsWith) |
|
| 284 | + if ($command instanceof Mailcode_Commands_Command_If_EndsWith) |
|
| 285 | 285 | { |
| 286 | 286 | return $command; |
| 287 | 287 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | { |
| 294 | 294 | $command = $this->instantiator->buildIfBiggerThan('If', $variable, $value); |
| 295 | 295 | |
| 296 | - if($command instanceof Mailcode_Commands_Command_If_BiggerThan) |
|
| 296 | + if ($command instanceof Mailcode_Commands_Command_If_BiggerThan) |
|
| 297 | 297 | { |
| 298 | 298 | return $command; |
| 299 | 299 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | { |
| 306 | 306 | $command = $this->instantiator->buildIfSmallerThan('If', $variable, $value); |
| 307 | 307 | |
| 308 | - if($command instanceof Mailcode_Commands_Command_If_SmallerThan) |
|
| 308 | + if ($command instanceof Mailcode_Commands_Command_If_SmallerThan) |
|
| 309 | 309 | { |
| 310 | 310 | return $command; |
| 311 | 311 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | { |
| 318 | 318 | $command = $this->instantiator->buildIfEquals('If', $variable, $value); |
| 319 | 319 | |
| 320 | - if($command instanceof Mailcode_Commands_Command_If_EqualsNumber) |
|
| 320 | + if ($command instanceof Mailcode_Commands_Command_If_EqualsNumber) |
|
| 321 | 321 | { |
| 322 | 322 | return $command; |
| 323 | 323 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $this->instantiator->checkCommand($cmd); |
| 42 | 42 | |
| 43 | - if($cmd instanceof Mailcode_Commands_Command_Comment) |
|
| 43 | + if ($cmd instanceof Mailcode_Commands_Command_Comment) |
|
| 44 | 44 | { |
| 45 | 45 | return $cmd; |
| 46 | 46 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @throws Mailcode_Exception |
| 58 | 58 | * @throws Mailcode_Factory_Exception |
| 59 | 59 | */ |
| 60 | - public function for(string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
| 60 | + public function for (string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
| 61 | 61 | { |
| 62 | 62 | $sourceVariable = '$'.ltrim($sourceVariable, '$'); |
| 63 | 63 | $loopVariable = '$'.ltrim($loopVariable, '$'); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $this->instantiator->checkCommand($cmd); |
| 81 | 81 | |
| 82 | - if($cmd instanceof Mailcode_Commands_Command_For) |
|
| 82 | + if ($cmd instanceof Mailcode_Commands_Command_For) |
|
| 83 | 83 | { |
| 84 | 84 | return $cmd; |
| 85 | 85 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $this->instantiator->checkCommand($cmd); |
| 109 | 109 | |
| 110 | - if($cmd instanceof Mailcode_Commands_Command_Break) |
|
| 110 | + if ($cmd instanceof Mailcode_Commands_Command_Break) |
|
| 111 | 111 | { |
| 112 | 112 | return $cmd; |
| 113 | 113 | } |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | * @throws Mailcode_Exception |
| 128 | 128 | * @throws Mailcode_Factory_Exception |
| 129 | 129 | */ |
| 130 | - public function mono(bool $multiline=false, array $classes=array()) : Mailcode_Commands_Command_Mono |
|
| 130 | + public function mono(bool $multiline = false, array $classes = array()) : Mailcode_Commands_Command_Mono |
|
| 131 | 131 | { |
| 132 | 132 | $params = ''; |
| 133 | 133 | $source = '{code'; |
| 134 | 134 | |
| 135 | - if($multiline) { |
|
| 135 | + if ($multiline) { |
|
| 136 | 136 | $params = 'multiline:'; |
| 137 | 137 | $source = '{code: multiline:'; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if(!empty($classes)) { |
|
| 140 | + if (!empty($classes)) { |
|
| 141 | 141 | $classString = sprintf('"%s"', implode(' ', $classes)); |
| 142 | 142 | $params .= $classString; |
| 143 | 143 | $source .= $classString; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $this->instantiator->checkCommand($cmd); |
| 156 | 156 | |
| 157 | - if($cmd instanceof Mailcode_Commands_Command_Mono) |
|
| 157 | + if ($cmd instanceof Mailcode_Commands_Command_Mono) |
|
| 158 | 158 | { |
| 159 | 159 | return $cmd; |
| 160 | 160 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $this->instantiator->checkCommand($cmd); |
| 181 | 181 | |
| 182 | - if($cmd instanceof Mailcode_Commands_Command_Code) |
|
| 182 | + if ($cmd instanceof Mailcode_Commands_Command_Code) |
|
| 183 | 183 | { |
| 184 | 184 | return $cmd; |
| 185 | 185 | } |