@@ -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 | } |
@@ -78,26 +78,26 @@ discard block |
||
78 | 78 | return $this->buildIf($ifType, $this->filterVariableName($variable), 'not-empty'); |
79 | 79 | } |
80 | 80 | |
81 | - public function buildIfContains(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
81 | + public function buildIfContains(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
82 | 82 | { |
83 | 83 | return $this->buildIfSearch($ifType, 'contains', $variable, $search, $caseInsensitive); |
84 | 84 | } |
85 | 85 | |
86 | - public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
86 | + public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
87 | 87 | { |
88 | 88 | return $this->buildIfSearch($ifType, 'begins-with', $variable, $search, $caseInsensitive); |
89 | 89 | } |
90 | 90 | |
91 | - public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
91 | + public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
92 | 92 | { |
93 | 93 | return $this->buildIfSearch($ifType, 'ends-with', $variable, $search, $caseInsensitive); |
94 | 94 | } |
95 | 95 | |
96 | - private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
96 | + private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
97 | 97 | { |
98 | 98 | $keyword = ' '; |
99 | 99 | |
100 | - if($caseInsensitive) |
|
100 | + if ($caseInsensitive) |
|
101 | 101 | { |
102 | 102 | $keyword = ' insensitive: '; |
103 | 103 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | public function checkCommand(Mailcode_Commands_Command $command) : void |
123 | 123 | { |
124 | - if($command->isValid()) |
|
124 | + if ($command->isValid()) |
|
125 | 125 | { |
126 | 126 | return; |
127 | 127 | } |
@@ -36,9 +36,9 @@ |
||
36 | 36 | ); |
37 | 37 | } |
38 | 38 | |
39 | - /** |
|
40 | - * @return array<string> |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @return array<string> |
|
41 | + */ |
|
42 | 42 | protected function getAllowedOperands() : array |
43 | 43 | { |
44 | 44 | return Mailcode_Parser_Statement_Tokenizer_Token_Operand::getComparisonSigns(); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $val = $this->validator->createStringLiteral(); |
35 | 35 | |
36 | - if($val->isValid()) |
|
36 | + if ($val->isValid()) |
|
37 | 37 | { |
38 | 38 | $this->searchTerm = $val->getToken(); |
39 | 39 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public function getSearchTerm() : string |
50 | 50 | { |
51 | - if($this->searchTerm instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
51 | + if ($this->searchTerm instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
52 | 52 | { |
53 | 53 | return $this->searchTerm->getNormalized(); |
54 | 54 | } |
@@ -36,8 +36,7 @@ |
||
36 | 36 | if($val->isValid()) |
37 | 37 | { |
38 | 38 | $this->searchTerm = $val->getToken(); |
39 | - } |
|
40 | - else |
|
39 | + } else |
|
41 | 40 | { |
42 | 41 | $this->validationResult->makeError( |
43 | 42 | t('No search term specified.'), |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | trait Mailcode_Traits_Commands_Validation_Value |
26 | 26 | { |
27 | - /** |
|
28 | - * @var Mailcode_Parser_Statement_Tokenizer_ValueInterface|NULL |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var Mailcode_Parser_Statement_Tokenizer_ValueInterface|NULL |
|
29 | + */ |
|
30 | 30 | protected $valueToken; |
31 | 31 | |
32 | 32 | protected function validateSyntax_value() : void |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - /** |
|
50 | - * Retrieves the variable being compared. |
|
51 | - * |
|
52 | - * @return string |
|
53 | - */ |
|
49 | + /** |
|
50 | + * Retrieves the variable being compared. |
|
51 | + * |
|
52 | + * @return string |
|
53 | + */ |
|
54 | 54 | public function getValue() : string |
55 | 55 | { |
56 | 56 | if($this->valueToken instanceof Mailcode_Parser_Statement_Tokenizer_ValueInterface) |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $var = $this->validator->createValue(); |
35 | 35 | |
36 | - if($var->isValid()) |
|
36 | + if ($var->isValid()) |
|
37 | 37 | { |
38 | 38 | $this->valueToken = $var->getToken(); |
39 | 39 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getValue() : string |
55 | 55 | { |
56 | - if($this->valueToken instanceof Mailcode_Parser_Statement_Tokenizer_ValueInterface) |
|
56 | + if ($this->valueToken instanceof Mailcode_Parser_Statement_Tokenizer_ValueInterface) |
|
57 | 57 | { |
58 | 58 | return $this->valueToken->getValue(); |
59 | 59 | } |
@@ -36,8 +36,7 @@ |
||
36 | 36 | if($var->isValid()) |
37 | 37 | { |
38 | 38 | $this->valueToken = $var->getToken(); |
39 | - } |
|
40 | - else |
|
39 | + } else |
|
41 | 40 | { |
42 | 41 | $this->validationResult->makeError( |
43 | 42 | t('No variable has been specified.'), |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | trait Mailcode_Traits_Commands_Validation_Operand |
27 | 27 | { |
28 | - /** |
|
29 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Operand|NULL |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Operand|NULL |
|
30 | + */ |
|
31 | 31 | protected $operandToken; |
32 | 32 | |
33 | - /** |
|
34 | - * @return string[] |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @return string[] |
|
35 | + */ |
|
36 | 36 | abstract protected function getAllowedOperands() : array; |
37 | 37 | |
38 | 38 | protected function validateSyntax_operand() : void |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | ); |
79 | 79 | } |
80 | 80 | |
81 | - /** |
|
82 | - * Retrieves the operand sign. |
|
83 | - * |
|
84 | - * @return string |
|
85 | - */ |
|
81 | + /** |
|
82 | + * Retrieves the operand sign. |
|
83 | + * |
|
84 | + * @return string |
|
85 | + */ |
|
86 | 86 | public function getSign() : string |
87 | 87 | { |
88 | 88 | return $this->getOperand()->getSign(); |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | { |
40 | 40 | $var = $this->validator->createOperand(); |
41 | 41 | |
42 | - if($var->isValid()) |
|
42 | + if ($var->isValid()) |
|
43 | 43 | { |
44 | - if(in_array($var->getSign(), $this->getAllowedOperands())) |
|
44 | + if (in_array($var->getSign(), $this->getAllowedOperands())) |
|
45 | 45 | { |
46 | 46 | $this->operandToken = $var->getToken(); |
47 | 47 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function getOperand() : Mailcode_Parser_Statement_Tokenizer_Token_Operand |
68 | 68 | { |
69 | - if($this->operandToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
69 | + if ($this->operandToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
70 | 70 | { |
71 | 71 | return $this->operandToken; |
72 | 72 | } |
@@ -44,8 +44,7 @@ discard block |
||
44 | 44 | if(in_array($var->getSign(), $this->getAllowedOperands())) |
45 | 45 | { |
46 | 46 | $this->operandToken = $var->getToken(); |
47 | - } |
|
48 | - else |
|
47 | + } else |
|
49 | 48 | { |
50 | 49 | $this->validationResult->makeError( |
51 | 50 | t('Invalid operand %1$s.', $var->getSign()).' '. |
@@ -54,8 +53,7 @@ discard block |
||
54 | 53 | Mailcode_Commands_CommonConstants::VALIDATION_INVALID_OPERAND |
55 | 54 | ); |
56 | 55 | } |
57 | - } |
|
58 | - else |
|
56 | + } else |
|
59 | 57 | { |
60 | 58 | $this->validationResult->makeError( |
61 | 59 | t('No operand has been specified.'), |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | trait Mailcode_Traits_Commands_Validation_Variable |
26 | 26 | { |
27 | - /** |
|
28 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
29 | + */ |
|
30 | 30 | protected $variableToken; |
31 | 31 | |
32 | 32 | protected function validateSyntax_variable() : void |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - /** |
|
50 | - * Retrieves the variable being compared. |
|
51 | - * |
|
52 | - * @return Mailcode_Variables_Variable |
|
53 | - */ |
|
49 | + /** |
|
50 | + * Retrieves the variable being compared. |
|
51 | + * |
|
52 | + * @return Mailcode_Variables_Variable |
|
53 | + */ |
|
54 | 54 | public function getVariable() : Mailcode_Variables_Variable |
55 | 55 | { |
56 | 56 | if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $var = $this->validator->createVariable(); |
35 | 35 | |
36 | - if($var->isValid()) |
|
36 | + if ($var->isValid()) |
|
37 | 37 | { |
38 | 38 | $this->variableToken = $var->getToken(); |
39 | 39 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getVariable() : Mailcode_Variables_Variable |
55 | 55 | { |
56 | - if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
56 | + if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
57 | 57 | { |
58 | 58 | return $this->variableToken->getVariable(); |
59 | 59 | } |
@@ -36,8 +36,7 @@ |
||
36 | 36 | if($var->isValid()) |
37 | 37 | { |
38 | 38 | $this->variableToken = $var->getToken(); |
39 | - } |
|
40 | - else |
|
39 | + } else |
|
41 | 40 | { |
42 | 41 | $this->validationResult->makeError( |
43 | 42 | t('No variable has been specified.'), |
@@ -24,9 +24,9 @@ |
||
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 | 32 | protected function validateSyntax_case_sensitive() : void |