@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | */ |
78 | 78 | private function getPath(string $jQueryNs, string $sPath, $xContext) |
79 | 79 | { |
80 | - if(!$sPath) |
|
80 | + if (!$sPath) |
|
81 | 81 | { |
82 | 82 | // If an empty selector is given, use javascript "this" instead |
83 | 83 | return "$jQueryNs(this)"; |
84 | 84 | } |
85 | - if(!$xContext) |
|
85 | + if (!$xContext) |
|
86 | 86 | { |
87 | 87 | return "$jQueryNs('" . $sPath . "')"; |
88 | 88 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | public function getScript(): string |
156 | 156 | { |
157 | 157 | $sScript = $this->sPath; |
158 | - if(count($this->aCalls) > 0) |
|
158 | + if (count($this->aCalls) > 0) |
|
159 | 159 | { |
160 | 160 | $sScript .= '.' . implode('.', $this->aCalls); |
161 | 161 | } |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | $aOptions = $this->getOptionNames($sKeyPrefix); |
137 | 137 | $sSpaces = str_repeat(' ', $nSpaces); |
138 | 138 | $sScript = ''; |
139 | - foreach($aOptions as $sShortName => $sFullName) |
|
139 | + foreach ($aOptions as $sShortName => $sFullName) |
|
140 | 140 | { |
141 | 141 | $value = $this->xConfigManager->getOption($sFullName); |
142 | - if(is_string($value)) |
|
142 | + if (is_string($value)) |
|
143 | 143 | { |
144 | 144 | $value = "'$value'"; |
145 | 145 | } |
146 | - elseif(is_bool($value)) |
|
146 | + elseif (is_bool($value)) |
|
147 | 147 | { |
148 | 148 | $value = ($value ? 'true' : 'false'); |
149 | 149 | } |
150 | - elseif(!is_numeric($value)) |
|
150 | + elseif (!is_numeric($value)) |
|
151 | 151 | { |
152 | 152 | $value = json_encode($value); |
153 | 153 | } |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getJsCode(string $sFile): string |
177 | 177 | { |
178 | - if($this->hasOption('assets.js')) |
|
178 | + if ($this->hasOption('assets.js')) |
|
179 | 179 | { |
180 | 180 | // If this expression evaluates to false, then the asset is not displayed. |
181 | - if(!($sUri = $this->getOption('assets.js'))) |
|
181 | + if (!($sUri = $this->getOption('assets.js'))) |
|
182 | 182 | { |
183 | 183 | return ''; |
184 | 184 | } |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function getCssCode(string $sFile): string |
202 | 202 | { |
203 | - if($this->hasOption('assets.css')) |
|
203 | + if ($this->hasOption('assets.css')) |
|
204 | 204 | { |
205 | 205 | // If this expression evaluates to false, then the asset is not displayed. |
206 | - if(!($sUri = $this->getOption('assets.css'))) |
|
206 | + if (!($sUri = $this->getOption('assets.css'))) |
|
207 | 207 | { |
208 | 208 | return ''; |
209 | 209 | } |
@@ -142,12 +142,10 @@ discard block |
||
142 | 142 | if(is_string($value)) |
143 | 143 | { |
144 | 144 | $value = "'$value'"; |
145 | - } |
|
146 | - elseif(is_bool($value)) |
|
145 | + } elseif(is_bool($value)) |
|
147 | 146 | { |
148 | 147 | $value = ($value ? 'true' : 'false'); |
149 | - } |
|
150 | - elseif(!is_numeric($value)) |
|
148 | + } elseif(!is_numeric($value)) |
|
151 | 149 | { |
152 | 150 | $value = json_encode($value); |
153 | 151 | } |
@@ -182,8 +180,7 @@ discard block |
||
182 | 180 | { |
183 | 181 | return ''; |
184 | 182 | } |
185 | - } |
|
186 | - else |
|
183 | + } else |
|
187 | 184 | { |
188 | 185 | $sUri = $this->sUri . '/' . ($this->sSubDir ? $this->sSubDir . '/' : '') . |
189 | 186 | ($this->sVersion ? $this->sVersion . '/' : '') . $sFile; |
@@ -207,8 +204,7 @@ discard block |
||
207 | 204 | { |
208 | 205 | return ''; |
209 | 206 | } |
210 | - } |
|
211 | - else |
|
207 | + } else |
|
212 | 208 | { |
213 | 209 | $sUri = $this->sUri . '/' . ($this->sSubDir ? $this->sSubDir . '/' : '') . |
214 | 210 | ($this->sVersion ? $this->sVersion . '/' : '') . $sFile; |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function _makeUniqueJsVar(ParameterInterface $xParameter): ParameterInterface |
81 | 81 | { |
82 | - if($xParameter instanceof DomSelector) |
|
82 | + if ($xParameter instanceof DomSelector) |
|
83 | 83 | { |
84 | 84 | $sParameterStr = $xParameter->getScript(); |
85 | - if(!isset($this->aVariables[$sParameterStr])) |
|
85 | + if (!isset($this->aVariables[$sParameterStr])) |
|
86 | 86 | { |
87 | 87 | // The value is not yet defined. A new variable is created. |
88 | 88 | $sVarName = 'jxnVar' . $this->nVarId; |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | */ |
110 | 110 | private function makePhrase(array $aArgs): string |
111 | 111 | { |
112 | - if(empty($aArgs)) |
|
112 | + if (empty($aArgs)) |
|
113 | 113 | { |
114 | 114 | return ''; |
115 | 115 | } |
116 | 116 | // The first array entry is the message. |
117 | 117 | $sPhrase = array_shift($aArgs); |
118 | - if(empty($aArgs)) |
|
118 | + if (empty($aArgs)) |
|
119 | 119 | { |
120 | 120 | return $sPhrase; |
121 | 121 | } |
122 | 122 | $nParamId = 1; |
123 | - foreach($aArgs as &$xParameter) |
|
123 | + foreach ($aArgs as &$xParameter) |
|
124 | 124 | { |
125 | 125 | $xParameter = $this->_makeUniqueJsVar($xParameter); |
126 | 126 | $xParameter = "'$nParamId':" . $xParameter->getScript(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | private function makeMessage(): string |
139 | 139 | { |
140 | - if(!($sPhrase = $this->makePhrase($this->aMessageArgs))) |
|
140 | + if (!($sPhrase = $this->makePhrase($this->aMessageArgs))) |
|
141 | 141 | { |
142 | 142 | return ''; |
143 | 143 | } |
@@ -166,23 +166,22 @@ discard block |
||
166 | 166 | // This array will avoid declaring multiple variables with the same value. |
167 | 167 | // The array key is the variable value, while the array value is the variable name. |
168 | 168 | $this->aVariables = []; // Array of local variables. |
169 | - foreach($this->aParameters as &$xParameter) |
|
169 | + foreach ($this->aParameters as &$xParameter) |
|
170 | 170 | { |
171 | 171 | $xParameter = $this->_makeUniqueJsVar($xParameter); |
172 | 172 | } |
173 | 173 | |
174 | 174 | $sMessageScript = $this->makeMessage(); |
175 | 175 | $sScript = parent::getScript(); |
176 | - if($this->bConfirm) |
|
176 | + if ($this->bConfirm) |
|
177 | 177 | { |
178 | 178 | $sConfirmPhrase = $this->makePhrase($this->aConfirmArgs); |
179 | 179 | $sScript = $this->xDialogLibraryManager->getQuestionLibrary() |
180 | 180 | ->confirm($sConfirmPhrase, $sScript, $sMessageScript); |
181 | 181 | } |
182 | - if($this->sCondition !== '') |
|
182 | + if ($this->sCondition !== '') |
|
183 | 183 | { |
184 | - $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' : |
|
185 | - 'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}'; |
|
184 | + $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' : 'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}'; |
|
186 | 185 | } |
187 | 186 | return $this->sVars . $sScript; |
188 | 187 | } |
@@ -194,9 +193,9 @@ discard block |
||
194 | 193 | */ |
195 | 194 | public function hasPageNumber(): bool |
196 | 195 | { |
197 | - foreach($this->aParameters as $xParameter) |
|
196 | + foreach ($this->aParameters as $xParameter) |
|
198 | 197 | { |
199 | - if($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
198 | + if ($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
200 | 199 | { |
201 | 200 | return true; |
202 | 201 | } |
@@ -214,9 +213,9 @@ discard block |
||
214 | 213 | public function setPageNumber(int $nPageNumber): Call |
215 | 214 | { |
216 | 215 | // Set the value of the Parameter::PAGE_NUMBER parameter |
217 | - foreach($this->aParameters as $xParameter) |
|
216 | + foreach ($this->aParameters as $xParameter) |
|
218 | 217 | { |
219 | - if($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
218 | + if ($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
220 | 219 | { |
221 | 220 | $xParameter->setValue($nPageNumber); |
222 | 221 | break; |
@@ -237,7 +236,7 @@ discard block |
||
237 | 236 | public function pages(int $nCurrentPage, int $nItemsPerPage, int $nItemsTotal): array |
238 | 237 | { |
239 | 238 | // Append the page number to the parameter list, if not yet given. |
240 | - if(!$this->hasPageNumber()) |
|
239 | + if (!$this->hasPageNumber()) |
|
241 | 240 | { |
242 | 241 | $this->addParameter(Parameter::PAGE_NUMBER, 0); |
243 | 242 | } |
@@ -256,7 +255,7 @@ discard block |
||
256 | 255 | public function paginate(int $nCurrentPage, int $nItemsPerPage, int $nItemsTotal): Paginator |
257 | 256 | { |
258 | 257 | // Append the page number to the parameter list, if not yet given. |
259 | - if(!$this->hasPageNumber()) |
|
258 | + if (!$this->hasPageNumber()) |
|
260 | 259 | { |
261 | 260 | $this->addParameter(Parameter::PAGE_NUMBER, 0); |
262 | 261 | } |
@@ -89,8 +89,7 @@ |
||
89 | 89 | $this->aVariables[$sParameterStr] = $sVarName; |
90 | 90 | $this->sVars .= "$sVarName=$xParameter;"; |
91 | 91 | $this->nVarId++; |
92 | - } |
|
93 | - else |
|
92 | + } else |
|
94 | 93 | { |
95 | 94 | // The value is already defined. The corresponding variable is assigned. |
96 | 95 | $sVarName = $this->aVariables[$sParameterStr]; |