@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $val = $this->validator->createVariable()->setIndex(0); |
75 | 75 | |
76 | - if($val->isValid()) |
|
76 | + if ($val->isValid()) |
|
77 | 77 | { |
78 | 78 | $this->variableToken = $val->getToken(); |
79 | 79 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | { |
91 | 91 | $tokens = $this->params->getInfo()->createPruner()->limitToOperands()->getTokens(); |
92 | 92 | |
93 | - foreach($tokens as $token) |
|
93 | + foreach ($tokens as $token) |
|
94 | 94 | { |
95 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
95 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
96 | 96 | { |
97 | 97 | $this->validateOperand($token); |
98 | 98 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | // ensure that the operand we have in the command is one of the |
110 | 110 | // allowed ones. |
111 | - if(!in_array($sign, $allowed)) |
|
111 | + if (!in_array($sign, $allowed)) |
|
112 | 112 | { |
113 | 113 | $this->validationResult->makeError( |
114 | 114 | t('The %1$s sign is not allowed in this command.', '<code>'.$sign.'</code>'), |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | { |
122 | 122 | $tokens = $this->getAssignmentTokens(); |
123 | 123 | |
124 | - if(empty($tokens)) |
|
124 | + if (empty($tokens)) |
|
125 | 125 | { |
126 | 126 | $this->validationResult->makeError( |
127 | 127 | t('No value assigned to the variable.'), |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function getVariable() : Mailcode_Variables_Variable |
134 | 134 | { |
135 | - if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
135 | + if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
136 | 136 | { |
137 | 137 | return $this->variableToken->getVariable(); |
138 | 138 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $eq = array_shift($params); // equals sign |
157 | 157 | |
158 | 158 | // in case the equals sign was omitted. |
159 | - if(!$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
159 | + if (!$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
160 | 160 | { |
161 | 161 | array_unshift($params, $eq); |
162 | 162 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $items = array(); |
172 | 172 | |
173 | - foreach($tokens as $token) |
|
173 | + foreach ($tokens as $token) |
|
174 | 174 | { |
175 | 175 | $items[] = $token->getNormalized(); |
176 | 176 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $tagName = strtolower($tagName); |
48 | 48 | |
49 | - if(!in_array($tagName, $this->excludeTags)) |
|
49 | + if (!in_array($tagName, $this->excludeTags)) |
|
50 | 50 | { |
51 | 51 | $this->excludeTags[] = $tagName; |
52 | 52 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function excludeTags(array $tagNames) : Mailcode_Parser_Safeguard_Formatter_HTMLHighlighting |
64 | 64 | { |
65 | - foreach($tagNames as $tagName) |
|
65 | + foreach ($tagNames as $tagName) |
|
66 | 66 | { |
67 | 67 | $this->excludeTag((string)$tagName); |
68 | 68 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $total = count($placeholders); |
64 | 64 | |
65 | - for($i=0; $i < $total; $i++) |
|
65 | + for ($i = 0; $i < $total; $i++) |
|
66 | 66 | { |
67 | 67 | $subject = $this->process($placeholders[$i], $subject); |
68 | 68 | } |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $locator = $placeholder->createLocator($subject); |
76 | 76 | $positions = $locator->getLocations(); |
77 | 77 | |
78 | - foreach($positions as $position) |
|
78 | + foreach ($positions as $position) |
|
79 | 79 | { |
80 | 80 | $replace = $this->resolveReplacementText($position); |
81 | 81 | |
82 | - if($replace !== $position->getPlaceholderString()) |
|
82 | + if ($replace !== $position->getPlaceholderString()) |
|
83 | 83 | { |
84 | 84 | $locator->replaceWith($position, $replace); |
85 | 85 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | $eol = ConvertHelper::detectEOLCharacter($subject); |
100 | 100 | |
101 | - if($eol) |
|
101 | + if ($eol) |
|
102 | 102 | { |
103 | 103 | return $eol->getCharacter(); |
104 | 104 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $locations = $this->origin->getNextAll(); |
102 | 102 | $offset = $this->lengthDifference; |
103 | 103 | |
104 | - foreach($locations as $location) |
|
104 | + foreach ($locations as $location) |
|
105 | 105 | { |
106 | 106 | $location->updatePositionByOffset($offset); |
107 | 107 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | $length = mb_strpos($this->replacementText, $this->placeholderText); |
115 | 115 | |
116 | - if($length === false) |
|
116 | + if ($length === false) |
|
117 | 117 | { |
118 | 118 | throw new Mailcode_Exception( |
119 | 119 | 'Replacement text does not contain placeholder string.', |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function getNext() : ?Mailcode_Parser_Safeguard_Placeholder_Locator_Location |
121 | 121 | { |
122 | - return $this->locator->getLocationByIndex(($this->index-1)); |
|
122 | + return $this->locator->getLocationByIndex(($this->index - 1)); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getPrevious() : ?Mailcode_Parser_Safeguard_Placeholder_Locator_Location |
131 | 131 | { |
132 | - return $this->locator->getLocationByIndex(($this->index+1)); |
|
132 | + return $this->locator->getLocationByIndex(($this->index + 1)); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | $locations = $this->locator->getLocations(); |
143 | 143 | |
144 | - return array_slice($locations, $this->index+1); |
|
144 | + return array_slice($locations, $this->index + 1); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | public function updatePositionByOffset(int $offset) : void |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $needle = $this->placeholder->getReplacementText(); |
64 | 64 | $index = 0; |
65 | 65 | |
66 | - while(($lastPos = mb_strpos($this->subject, $needle, $lastPos)) !== false) |
|
66 | + while (($lastPos = mb_strpos($this->subject, $needle, $lastPos)) !== false) |
|
67 | 67 | { |
68 | 68 | $length = mb_strlen($needle); |
69 | 69 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function getLocationByIndex(int $index) : ?Mailcode_Parser_Safeguard_Placeholder_Locator_Location |
100 | 100 | { |
101 | - if(isset($this->instances[$index])) |
|
101 | + if (isset($this->instances[$index])) |
|
102 | 102 | { |
103 | 103 | return $this->instances[$index]; |
104 | 104 | } |