@@ -24,14 +24,14 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | trait Mailcode_Traits_Commands_Validation_CaseSensitive |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var boolean |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var boolean |
|
| 29 | + */ |
|
| 30 | 30 | protected $caseInsensitive = false; |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 34 | + */ |
|
| 35 | 35 | protected $caseToken; |
| 36 | 36 | |
| 37 | 37 | protected function validateSyntax_case_sensitive() : void |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $this->caseInsensitive = $val->isValid(); |
| 42 | 42 | |
| 43 | - if($val->isValid()) |
|
| 43 | + if ($val->isValid()) |
|
| 44 | 44 | { |
| 45 | 45 | $this->caseToken = $val->getToken(); |
| 46 | 46 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function getCaseToken() : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
| 55 | 55 | { |
| 56 | - if($this->caseToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 56 | + if ($this->caseToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 57 | 57 | { |
| 58 | 58 | return $this->caseToken; |
| 59 | 59 | } |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class Mailcode_Commands_Command_Comment extends Mailcode_Commands_Command implements Mailcode_Commands_Command_Type_Standalone |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | 26 | private $commentString = ''; |
| 27 | 27 | |
| 28 | 28 | protected function init() : void |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | |
| 81 | 81 | protected function validateSyntax_comment() : void |
| 82 | 82 | { |
| 83 | - if(empty($this->commentString)) |
|
| 83 | + if (empty($this->commentString)) |
|
| 84 | 84 | { |
| 85 | 85 | $this->validationResult->makeError( |
| 86 | 86 | t('The comment text ist empty.'), |
@@ -78,13 +78,13 @@ |
||
| 78 | 78 | return $this->buildIf($ifType, $this->filterVariableName($variable), 'not-empty'); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * @param string $ifType |
|
| 83 | - * @param string $variable |
|
| 84 | - * @param string[] $searchTerms |
|
| 85 | - * @param bool $caseInsensitive |
|
| 86 | - * @return Mailcode_Commands_IfBase |
|
| 87 | - */ |
|
| 81 | + /** |
|
| 82 | + * @param string $ifType |
|
| 83 | + * @param string $variable |
|
| 84 | + * @param string[] $searchTerms |
|
| 85 | + * @param bool $caseInsensitive |
|
| 86 | + * @return Mailcode_Commands_IfBase |
|
| 87 | + */ |
|
| 88 | 88 | public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
| 89 | 89 | { |
| 90 | 90 | $keyword = ' '; |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class Mailcode_Factory_Instantiator |
| 22 | 22 | { |
| 23 | - public function buildIf(string $ifType, string $params, string $type='') : Mailcode_Commands_IfBase |
|
| 23 | + public function buildIf(string $ifType, string $params, string $type = '') : Mailcode_Commands_IfBase |
|
| 24 | 24 | { |
| 25 | 25 | $stringType = $type; |
| 26 | 26 | |
| 27 | - if(!empty($type)) |
|
| 27 | + if (!empty($type)) |
|
| 28 | 28 | { |
| 29 | 29 | $stringType = ' '.$type; |
| 30 | 30 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $this->checkCommand($command); |
| 45 | 45 | |
| 46 | - if($command instanceof Mailcode_Commands_IfBase) |
|
| 46 | + if ($command instanceof Mailcode_Commands_IfBase) |
|
| 47 | 47 | { |
| 48 | 48 | return $command; |
| 49 | 49 | } |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | throw $this->exceptionUnexpectedType('IfBase', $command); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_IfBase |
|
| 54 | + public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_IfBase |
|
| 55 | 55 | { |
| 56 | - if($quoteValue) |
|
| 56 | + if ($quoteValue) |
|
| 57 | 57 | { |
| 58 | 58 | $value = $this->quoteString($value); |
| 59 | 59 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | * @param bool $caseInsensitive |
| 86 | 86 | * @return Mailcode_Commands_IfBase |
| 87 | 87 | */ |
| 88 | - public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
| 88 | + public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
| 89 | 89 | { |
| 90 | 90 | $keyword = ' '; |
| 91 | 91 | |
| 92 | - if($caseInsensitive) |
|
| 92 | + if ($caseInsensitive) |
|
| 93 | 93 | { |
| 94 | 94 | $keyword = ' insensitive: '; |
| 95 | 95 | } |
@@ -104,21 +104,21 @@ discard block |
||
| 104 | 104 | return $this->buildIf($ifType, $condition, 'contains'); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
| 107 | + public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
| 108 | 108 | { |
| 109 | 109 | return $this->buildIfSearch($ifType, 'begins-with', $variable, $search, $caseInsensitive); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
| 112 | + public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
| 113 | 113 | { |
| 114 | 114 | return $this->buildIfSearch($ifType, 'ends-with', $variable, $search, $caseInsensitive); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
| 117 | + private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
| 118 | 118 | { |
| 119 | 119 | $keyword = ' '; |
| 120 | 120 | |
| 121 | - if($caseInsensitive) |
|
| 121 | + if ($caseInsensitive) |
|
| 122 | 122 | { |
| 123 | 123 | $keyword = ' insensitive: '; |
| 124 | 124 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | public function checkCommand(Mailcode_Commands_Command $command) : void |
| 149 | 149 | { |
| 150 | - if($command->isValid()) |
|
| 150 | + if ($command->isValid()) |
|
| 151 | 151 | { |
| 152 | 152 | return; |
| 153 | 153 | } |
@@ -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); |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class Mailcode_Factory_CommandSets_Set_ElseIf extends Mailcode_Factory_CommandSets_IfBase |
| 22 | 22 | { |
| 23 | - public function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf |
|
| 23 | + public function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf |
|
| 24 | 24 | { |
| 25 | 25 | $command = $this->instantiator->buildIf('ElseIf', $condition, $type); |
| 26 | 26 | |
| 27 | - if($command instanceof Mailcode_Commands_Command_ElseIf) |
|
| 27 | + if ($command instanceof Mailcode_Commands_Command_ElseIf) |
|
| 28 | 28 | { |
| 29 | 29 | return $command; |
| 30 | 30 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | throw $this->instantiator->exceptionUnexpectedType('ElseIf', $command); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 35 | + public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 36 | 36 | { |
| 37 | 37 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, $operand, $value, $quoteValue); |
| 38 | 38 | |
| 39 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 39 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 40 | 40 | { |
| 41 | 41 | return $command; |
| 42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, $operand, $value, true); |
| 50 | 50 | |
| 51 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 51 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 52 | 52 | { |
| 53 | 53 | return $command; |
| 54 | 54 | } |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarString', $command); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 59 | + public function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 60 | 60 | { |
| 61 | 61 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '==', $value, $quoteValue); |
| 62 | 62 | |
| 63 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 63 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 64 | 64 | { |
| 65 | 65 | return $command; |
| 66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '==', $value, true); |
| 74 | 74 | |
| 75 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 75 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 76 | 76 | { |
| 77 | 77 | return $command; |
| 78 | 78 | } |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarEqualsString', $command); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 83 | + public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 84 | 84 | { |
| 85 | 85 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '!=', $value, $quoteValue); |
| 86 | 86 | |
| 87 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 87 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 88 | 88 | { |
| 89 | 89 | return $command; |
| 90 | 90 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '!=', $value, true); |
| 98 | 98 | |
| 99 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 99 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 100 | 100 | { |
| 101 | 101 | return $command; |
| 102 | 102 | } |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | * @param bool $caseInsensitive |
| 111 | 111 | * @return Mailcode_Commands_Command_ElseIf_Contains |
| 112 | 112 | */ |
| 113 | - public function elseIfContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
|
| 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); |
| 116 | 116 | |
| 117 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Contains) |
|
| 117 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Contains) |
|
| 118 | 118 | { |
| 119 | 119 | return $command; |
| 120 | 120 | } |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | throw $this->instantiator->exceptionUnexpectedType('ElseIfContains', $command); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
| 125 | + public function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
| 126 | 126 | { |
| 127 | 127 | $command = $this->instantiator->buildIfBeginsWith('ElseIf', $variable, $search, $caseInsensitive); |
| 128 | 128 | |
| 129 | - if($command instanceof Mailcode_Commands_Command_ElseIf_BeginsWith) |
|
| 129 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_BeginsWith) |
|
| 130 | 130 | { |
| 131 | 131 | return $command; |
| 132 | 132 | } |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | throw $this->instantiator->exceptionUnexpectedType('ElseIfBeginsWith', $command); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
| 137 | + public function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
| 138 | 138 | { |
| 139 | 139 | $command = $this->instantiator->buildIfEndsWith('ElseIf', $variable, $search, $caseInsensitive); |
| 140 | 140 | |
| 141 | - if($command instanceof Mailcode_Commands_Command_ElseIf_EndsWith) |
|
| 141 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_EndsWith) |
|
| 142 | 142 | { |
| 143 | 143 | return $command; |
| 144 | 144 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $command = $this->instantiator->buildIfEmpty('ElseIf', $variable); |
| 152 | 152 | |
| 153 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Empty) |
|
| 153 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Empty) |
|
| 154 | 154 | { |
| 155 | 155 | return $command; |
| 156 | 156 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | $command = $this->instantiator->buildIfNotEmpty('ElseIf', $variable); |
| 164 | 164 | |
| 165 | - if($command instanceof Mailcode_Commands_Command_ElseIf_NotEmpty) |
|
| 165 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_NotEmpty) |
|
| 166 | 166 | { |
| 167 | 167 | return $command; |
| 168 | 168 | } |
@@ -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); |
@@ -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 ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
| 35 | + public function ifVar(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 ifVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
| 59 | + public function ifVarEquals(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 ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
| 83 | + public function ifVarNotEquals(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 | } |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | * @param bool $caseInsensitive |
| 135 | 135 | * @return Mailcode_Commands_Command_If_Contains |
| 136 | 136 | */ |
| 137 | - public function ifContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
|
| 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); |
| 140 | 140 | |
| 141 | - if($command instanceof Mailcode_Commands_Command_If_Contains) |
|
| 141 | + if ($command instanceof Mailcode_Commands_Command_If_Contains) |
|
| 142 | 142 | { |
| 143 | 143 | return $command; |
| 144 | 144 | } |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | throw $this->instantiator->exceptionUnexpectedType('IfContains', $command); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function ifBeginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_BeginsWith |
|
| 149 | + public function ifBeginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_BeginsWith |
|
| 150 | 150 | { |
| 151 | 151 | $command = $this->instantiator->buildIfBeginsWith('If', $variable, $search, $caseInsensitive); |
| 152 | 152 | |
| 153 | - if($command instanceof Mailcode_Commands_Command_If_BeginsWith) |
|
| 153 | + if ($command instanceof Mailcode_Commands_Command_If_BeginsWith) |
|
| 154 | 154 | { |
| 155 | 155 | return $command; |
| 156 | 156 | } |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | throw $this->instantiator->exceptionUnexpectedType('IfBeginsWith', $command); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - public function ifEndsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_EndsWith |
|
| 161 | + public function ifEndsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_EndsWith |
|
| 162 | 162 | { |
| 163 | 163 | $command = $this->instantiator->buildIfEndsWith('If', $variable, $search, $caseInsensitive); |
| 164 | 164 | |
| 165 | - if($command instanceof Mailcode_Commands_Command_If_EndsWith) |
|
| 165 | + if ($command instanceof Mailcode_Commands_Command_If_EndsWith) |
|
| 166 | 166 | { |
| 167 | 167 | return $command; |
| 168 | 168 | } |
@@ -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. |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | |
| 62 | 62 | // All other special characters have to be escaped |
| 63 | 63 | // with two backslashes. |
| 64 | - foreach($this->regexSpecialChars as $char) |
|
| 64 | + foreach ($this->regexSpecialChars as $char) |
|
| 65 | 65 | { |
| 66 | 66 | $string = str_replace($char, '\\\\'.$char, $string); |
| 67 | 67 | } |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class Mailcode_Parser_Safeguard_Formatter_SingleLines extends Mailcode_Parser_Safeguard_Formatter |
| 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(string $subject) : string |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | return $this->eolLength; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * We only use placeholders that contain commands that do |
|
| 56 | - * not generate contents, since these are the only ones |
|
| 57 | - * that may need adjusting. |
|
| 58 | - * |
|
| 59 | - * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
| 60 | - */ |
|
| 54 | + /** |
|
| 55 | + * We only use placeholders that contain commands that do |
|
| 56 | + * not generate contents, since these are the only ones |
|
| 57 | + * that may need adjusting. |
|
| 58 | + * |
|
| 59 | + * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
| 60 | + */ |
|
| 61 | 61 | protected function filterPlaceholders() |
| 62 | 62 | { |
| 63 | 63 | $placeholders = $this->safeguard->getPlaceholders(); |
@@ -64,9 +64,9 @@ |
||
| 64 | 64 | |
| 65 | 65 | $result = array(); |
| 66 | 66 | |
| 67 | - foreach($placeholders as $placeholder) |
|
| 67 | + foreach ($placeholders as $placeholder) |
|
| 68 | 68 | { |
| 69 | - if(!$placeholder->getCommand()->generatesContent()) |
|
| 69 | + if (!$placeholder->getCommand()->generatesContent()) |
|
| 70 | 70 | { |
| 71 | 71 | $result[] = $placeholder; |
| 72 | 72 | } |
@@ -23,24 +23,24 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class Mailcode_Parser_Safeguard_Formatter_SingleLines_Location extends Mailcode_Parser_Safeguard_FormatterLocation |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var int |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var int |
|
| 28 | + */ |
|
| 29 | 29 | protected $eolLength; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var string |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var string |
|
| 33 | + */ |
|
| 34 | 34 | protected $eol; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var boolean |
|
| 38 | - */ |
|
| 36 | + /** |
|
| 37 | + * @var boolean |
|
| 38 | + */ |
|
| 39 | 39 | protected $prepend = false; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var boolean |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var boolean |
|
| 43 | + */ |
|
| 44 | 44 | protected $append = false; |
| 45 | 45 | |
| 46 | 46 | protected function init() : void |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | $this->analyzeAppend(); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Whether an EOL character needs to be appended or prepended. |
|
| 57 | - * |
|
| 58 | - * @return bool |
|
| 59 | - */ |
|
| 55 | + /** |
|
| 56 | + * Whether an EOL character needs to be appended or prepended. |
|
| 57 | + * |
|
| 58 | + * @return bool |
|
| 59 | + */ |
|
| 60 | 60 | public function requiresAdjustment() : bool |
| 61 | 61 | { |
| 62 | 62 | return $this->requiresAppend() || $this->requiresPrepend(); |
@@ -77,21 +77,21 @@ discard block |
||
| 77 | 77 | $position = $this->location->getStartPosition(); |
| 78 | 78 | |
| 79 | 79 | // we're at the beginning of the string |
| 80 | - if($position == 0) |
|
| 80 | + if ($position == 0) |
|
| 81 | 81 | { |
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $prevPos = $position - $this->eolLength; |
| 86 | 86 | |
| 87 | - if($prevPos < 0) |
|
| 87 | + if ($prevPos < 0) |
|
| 88 | 88 | { |
| 89 | 89 | $prevPos = 0; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $prev = mb_substr($this->location->getSubjectString(), $prevPos, $this->eolLength); |
| 93 | 93 | |
| 94 | - if($prev !== $this->formatter->getEOLChar()) |
|
| 94 | + if ($prev !== $this->formatter->getEOLChar()) |
|
| 95 | 95 | { |
| 96 | 96 | $this->prepend = true; |
| 97 | 97 | } |
@@ -104,21 +104,21 @@ discard block |
||
| 104 | 104 | $position = $this->location->getEndPosition(); |
| 105 | 105 | |
| 106 | 106 | // we're at the end of the string |
| 107 | - if($position >= $subjectLength) |
|
| 107 | + if ($position >= $subjectLength) |
|
| 108 | 108 | { |
| 109 | 109 | return; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $nextPos = $position + $this->eolLength; |
| 113 | 113 | |
| 114 | - if($nextPos > $subjectLength) |
|
| 114 | + if ($nextPos > $subjectLength) |
|
| 115 | 115 | { |
| 116 | 116 | $nextPos = $subjectLength - $this->eolLength; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $next = mb_substr($this->location->getSubjectString(), $nextPos, $this->eolLength); |
| 120 | 120 | |
| 121 | - if($next !== $this->formatter->getEOLChar()) |
|
| 121 | + if ($next !== $this->formatter->getEOLChar()) |
|
| 122 | 122 | { |
| 123 | 123 | $this->append = true; |
| 124 | 124 | } |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | $prepend = ''; |
| 130 | 130 | $append = ''; |
| 131 | 131 | |
| 132 | - if($this->requiresPrepend()) |
|
| 132 | + if ($this->requiresPrepend()) |
|
| 133 | 133 | { |
| 134 | 134 | $prepend = $this->eol; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if($this->requiresAppend()) |
|
| 137 | + if ($this->requiresAppend()) |
|
| 138 | 138 | { |
| 139 | 139 | $append = $this->eol; |
| 140 | 140 | } |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | const COMMAND_MARKER = '__MAILCODE_COMMAND__'; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var array<int,array<int,string>> |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var array<int,array<int,string>> |
|
| 29 | + */ |
|
| 30 | 30 | private $tagAncestry; |
| 31 | 31 | |
| 32 | 32 | protected function init() : void |
@@ -49,18 +49,18 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | if($this->isInTagAttributes() || $this->isInExcludedTag()) |
| 51 | 51 | { |
| 52 | - return false; |
|
| 52 | + return false; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return true; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Retrieves the part of the subject string that comes |
|
| 60 | - * before the command. |
|
| 61 | - * |
|
| 62 | - * @return string |
|
| 63 | - */ |
|
| 58 | + /** |
|
| 59 | + * Retrieves the part of the subject string that comes |
|
| 60 | + * before the command. |
|
| 61 | + * |
|
| 62 | + * @return string |
|
| 63 | + */ |
|
| 64 | 64 | private function getHaystackBefore() : string |
| 65 | 65 | { |
| 66 | 66 | $pos = $this->location->getStartPosition(); |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | return mb_substr($subject, 0, $pos).self::COMMAND_MARKER.'>'; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Whether the command is nested in one of the tags |
|
| 85 | - * that have been added to the list of excluded tags. |
|
| 86 | - * |
|
| 87 | - * @return bool |
|
| 88 | - */ |
|
| 83 | + /** |
|
| 84 | + * Whether the command is nested in one of the tags |
|
| 85 | + * that have been added to the list of excluded tags. |
|
| 86 | + * |
|
| 87 | + * @return bool |
|
| 88 | + */ |
|
| 89 | 89 | private function isInExcludedTag() : bool |
| 90 | 90 | { |
| 91 | 91 | $tagNames = $this->getParentTags(); |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Retrieves a list of the command's parent HTML tags, from |
|
| 106 | - * highest to lowest. |
|
| 107 | - * |
|
| 108 | - * @return string[] |
|
| 109 | - */ |
|
| 104 | + /** |
|
| 105 | + * Retrieves a list of the command's parent HTML tags, from |
|
| 106 | + * highest to lowest. |
|
| 107 | + * |
|
| 108 | + * @return string[] |
|
| 109 | + */ |
|
| 110 | 110 | private function getParentTags() : array |
| 111 | 111 | { |
| 112 | 112 | // Create a stack of all direct parent tags of the command. |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | return $stack; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Checks whether the command is located within the attributes |
|
| 134 | - * of an HTML tag. |
|
| 135 | - * |
|
| 136 | - * @return bool |
|
| 137 | - */ |
|
| 132 | + /** |
|
| 133 | + * Checks whether the command is located within the attributes |
|
| 134 | + * of an HTML tag. |
|
| 135 | + * |
|
| 136 | + * @return bool |
|
| 137 | + */ |
|
| 138 | 138 | private function isInTagAttributes() : bool |
| 139 | 139 | { |
| 140 | 140 | // This check is easy: if the command is in the attribute |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | public function requiresAdjustment(): bool |
| 49 | 49 | { |
| 50 | - if($this->isInTagAttributes() || $this->isInExcludedTag()) |
|
| 50 | + if ($this->isInTagAttributes() || $this->isInExcludedTag()) |
|
| 51 | 51 | { |
| 52 | 52 | return false; |
| 53 | 53 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $pos = $this->location->getStartPosition(); |
| 67 | 67 | |
| 68 | 68 | // at the beginning of the document? Sure, we can highlight this. |
| 69 | - if($pos === 0) |
|
| 69 | + if ($pos === 0) |
|
| 70 | 70 | { |
| 71 | 71 | return ''; |
| 72 | 72 | } |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $tagNames = $this->getParentTags(); |
| 92 | 92 | |
| 93 | - foreach($tagNames as $tagName) |
|
| 93 | + foreach ($tagNames as $tagName) |
|
| 94 | 94 | { |
| 95 | - if($this->formatter->isTagExcluded($tagName)) |
|
| 95 | + if ($this->formatter->isTagExcluded($tagName)) |
|
| 96 | 96 | { |
| 97 | 97 | return true; |
| 98 | 98 | } |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | // Create a stack of all direct parent tags of the command. |
| 113 | 113 | // Handles closing tags as well. |
| 114 | 114 | $stack = array(); |
| 115 | - foreach($this->tagAncestry[2] as $idx => $tagName) |
|
| 115 | + foreach ($this->tagAncestry[2] as $idx => $tagName) |
|
| 116 | 116 | { |
| 117 | 117 | $closing = $this->tagAncestry[1][$idx] === '/'; |
| 118 | 118 | |
| 119 | - if($closing) |
|
| 119 | + if ($closing) |
|
| 120 | 120 | { |
| 121 | 121 | array_pop($stack); |
| 122 | 122 | } |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | // This check is easy: if the command is in the attribute |
| 141 | 141 | // of any of the tags, we will find the command marker in there. |
| 142 | - foreach($this->tagAncestry[3] as $attributes) |
|
| 142 | + foreach ($this->tagAncestry[3] as $attributes) |
|
| 143 | 143 | { |
| 144 | - if(strstr($attributes, self::COMMAND_MARKER)) |
|
| 144 | + if (strstr($attributes, self::COMMAND_MARKER)) |
|
| 145 | 145 | { |
| 146 | 146 | return true; |
| 147 | 147 | } |
@@ -119,8 +119,7 @@ |
||
| 119 | 119 | if($closing) |
| 120 | 120 | { |
| 121 | 121 | array_pop($stack); |
| 122 | - } |
|
| 123 | - else |
|
| 122 | + } else |
|
| 124 | 123 | { |
| 125 | 124 | $stack[] = $tagName; |
| 126 | 125 | } |