@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $variable = $this->params->getInfo()->getVariableByIndex(0); |
60 | 60 | |
61 | - if($variable) |
|
61 | + if ($variable) |
|
62 | 62 | { |
63 | 63 | return $variable->getVariable(); |
64 | 64 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | protected function validateSyntax_assignment() : void |
88 | 88 | { |
89 | - if($this->params->getInfo()->isVariableAssignment()) |
|
89 | + if ($this->params->getInfo()->isVariableAssignment()) |
|
90 | 90 | { |
91 | 91 | return; |
92 | 92 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | protected function init() : void |
24 | 24 | { |
25 | 25 | // automatically quote the parameters, since comments don't require any. |
26 | - if(!strstr($this->paramsString, '"')) |
|
26 | + if (!strstr($this->paramsString, '"')) |
|
27 | 27 | { |
28 | 28 | $this->paramsString = '"'.$this->paramsString.'"'; |
29 | 29 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $this->validate(); |
64 | 64 | |
65 | - if(isset($this->variable)) |
|
65 | + if (isset($this->variable)) |
|
66 | 66 | { |
67 | 67 | return $this->variable; |
68 | 68 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $vars = $this->getVariables()->getGroupedByName(); |
94 | 94 | $amount = count($vars); |
95 | 95 | |
96 | - if($amount === 1) |
|
96 | + if ($amount === 1) |
|
97 | 97 | { |
98 | 98 | $this->variable = array_pop($vars); |
99 | 99 | return; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function getVariable() : ?Mailcode_Variables_Variable |
66 | 66 | { |
67 | - if(isset($this->variable)) |
|
67 | + if (isset($this->variable)) |
|
68 | 68 | { |
69 | 69 | return $this->variable; |
70 | 70 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $amount = $this->getVariables()->countVariables(); |
78 | 78 | |
79 | - if($amount >= 1) |
|
79 | + if ($amount >= 1) |
|
80 | 80 | { |
81 | 81 | return; |
82 | 82 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | $validations = array(); |
93 | 93 | |
94 | - if($this->getType() === 'variable') |
|
94 | + if ($this->getType() === 'variable') |
|
95 | 95 | { |
96 | 96 | $validations[] = 'require_variable'; |
97 | 97 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $keyword = $info->getKeywordByIndex(1); |
63 | 63 | $container = $info->getVariableByIndex(2); |
64 | 64 | |
65 | - if($variable && $keyword && $container && $keyword->isForIn()) |
|
65 | + if ($variable && $keyword && $container && $keyword->isForIn()) |
|
66 | 66 | { |
67 | 67 | return; |
68 | 68 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $this->parts[] = $this->renderTag(array('command-name'), $this->command->getName()); |
53 | 53 | |
54 | - if($this->command->hasType()) |
|
54 | + if ($this->command->hasType()) |
|
55 | 55 | { |
56 | 56 | $this->parts[] = ' '.$this->renderTag(array('command-type'), $this->command->getType()); |
57 | 57 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | protected function appendParams() : void |
64 | 64 | { |
65 | - if($this->command->hasParameters()) |
|
65 | + if ($this->command->hasParameters()) |
|
66 | 66 | { |
67 | 67 | $this->parts[] = ' '.$this->renderTag(array('params'), $this->command->getParamsString()); |
68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $parts = array(); |
79 | 79 | |
80 | - foreach($classes as $class) |
|
80 | + foreach ($classes as $class) |
|
81 | 81 | { |
82 | 82 | $parts[] = 'mailcode-'.$class; |
83 | 83 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | public function getHash() : string |
98 | 98 | { |
99 | - if(empty($this->hash)) |
|
99 | + if (empty($this->hash)) |
|
100 | 100 | { |
101 | 101 | $this->hash = md5($this->matchedText); |
102 | 102 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | public function getValidationResult() : OperationResult |
113 | 113 | { |
114 | - if(isset($this->validationResult)) |
|
114 | + if (isset($this->validationResult)) |
|
115 | 115 | { |
116 | 116 | return $this->validationResult; |
117 | 117 | } |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | |
126 | 126 | protected function validate() : void |
127 | 127 | { |
128 | - foreach($this->validations as $validation) |
|
128 | + foreach ($this->validations as $validation) |
|
129 | 129 | { |
130 | 130 | $method = 'validate_'.$validation; |
131 | 131 | |
132 | - if(!method_exists($this, $method)) |
|
132 | + if (!method_exists($this, $method)) |
|
133 | 133 | { |
134 | 134 | throw new Mailcode_Exception( |
135 | 135 | 'Unknown validation method', |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $this->$method(); |
146 | 146 | |
147 | - if(!$this->validationResult->isValid()) |
|
147 | + if (!$this->validationResult->isValid()) |
|
148 | 148 | { |
149 | 149 | return; |
150 | 150 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | protected function validateNumber(string $value, int $errorCode) : void |
175 | 175 | { |
176 | - if(!is_numeric(substr($value, 0, 1))) |
|
176 | + if (!is_numeric(substr($value, 0, 1))) |
|
177 | 177 | { |
178 | 178 | return; |
179 | 179 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $length = strlen($value); |
194 | 194 | |
195 | 195 | // trimming underscores does not change the length: no underscores at start or end of string. |
196 | - if(strlen(trim($value, '_')) == $length) |
|
196 | + if (strlen(trim($value, '_')) == $length) |
|
197 | 197 | { |
198 | 198 | return; |
199 | 199 | } |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | { |
63 | 63 | $fullName = $this->fixName($fullName); |
64 | 64 | |
65 | - foreach($this->variables as $variable) |
|
65 | + foreach ($this->variables as $variable) |
|
66 | 66 | { |
67 | - if($variable->getFullName() === $fullName) |
|
67 | + if ($variable->getFullName() === $fullName) |
|
68 | 68 | { |
69 | 69 | return true; |
70 | 70 | } |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | $collection = new Mailcode_Variables_Collection_Regular(); |
89 | 89 | |
90 | - foreach($this->variables as $variable) |
|
90 | + foreach ($this->variables as $variable) |
|
91 | 91 | { |
92 | - if($variable->getFullName() === $fullName) |
|
92 | + if ($variable->getFullName() === $fullName) |
|
93 | 93 | { |
94 | 94 | $collection->add($variable); |
95 | 95 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | protected function fixName(string $fullName) : string |
108 | 108 | { |
109 | - if(substr($fullName, 0, 1) === '$') |
|
109 | + if (substr($fullName, 0, 1) === '$') |
|
110 | 110 | { |
111 | 111 | return $fullName; |
112 | 112 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | { |
125 | 125 | $entries = array(); |
126 | 126 | |
127 | - foreach($this->variables as $variable) |
|
127 | + foreach ($this->variables as $variable) |
|
128 | 128 | { |
129 | 129 | $entries[$variable->getHash()] = $variable; |
130 | 130 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | $entries = array(); |
143 | 143 | |
144 | - foreach($this->variables as $variable) |
|
144 | + foreach ($this->variables as $variable) |
|
145 | 145 | { |
146 | 146 | $entries[$variable->getFullName()] = $variable; |
147 | 147 | } |
@@ -166,11 +166,11 @@ discard block |
||
166 | 166 | { |
167 | 167 | $result = array(); |
168 | 168 | |
169 | - foreach($this->variables as $variable) |
|
169 | + foreach ($this->variables as $variable) |
|
170 | 170 | { |
171 | 171 | $name = $variable->getFullName(); |
172 | 172 | |
173 | - if(!in_array($name, $result)) |
|
173 | + if (!in_array($name, $result)) |
|
174 | 174 | { |
175 | 175 | $result[] = $name; |
176 | 176 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | { |
210 | 210 | $variables = $collection->getGroupedByHash(); |
211 | 211 | |
212 | - foreach($variables as $variable) |
|
212 | + foreach ($variables as $variable) |
|
213 | 213 | { |
214 | 214 | $this->add($variable); |
215 | 215 | } |
@@ -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 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | $token = $this->getTokenByIndex($index); |
101 | 101 | |
102 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
102 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
103 | 103 | { |
104 | 104 | return $token; |
105 | 105 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $token = $this->getTokenByIndex($index); |
113 | 113 | |
114 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
114 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
115 | 115 | { |
116 | 116 | return $token; |
117 | 117 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | { |
124 | 124 | $token = $this->getTokenByIndex($index); |
125 | 125 | |
126 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
126 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
127 | 127 | { |
128 | 128 | return $token; |
129 | 129 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | public function getTokenByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token |
135 | 135 | { |
136 | - if(isset($this->tokens[$index])) |
|
136 | + if (isset($this->tokens[$index])) |
|
137 | 137 | { |
138 | 138 | return $this->tokens[$index]; |
139 | 139 | } |