@@ -131,18 +131,18 @@ |
||
131 | 131 | public function render(Paginator $xPaginator, Call $xCall, string $sWrapperId) |
132 | 132 | { |
133 | 133 | $aPages = $xPaginator->pages(); |
134 | - if(count($aPages) === 0) |
|
134 | + if (count($aPages) === 0) |
|
135 | 135 | { |
136 | 136 | return; |
137 | 137 | } |
138 | 138 | $xStore = $this->_render($aPages); |
139 | - if(!$xStore) |
|
139 | + if (!$xStore) |
|
140 | 140 | { |
141 | 141 | return; |
142 | 142 | } |
143 | 143 | |
144 | 144 | // Append the page number to the parameter list, if not yet given. |
145 | - if(!$xCall->hasPageNumber()) |
|
145 | + if (!$xCall->hasPageNumber()) |
|
146 | 146 | { |
147 | 147 | $xCall->addParameter(Parameter::PAGE_NUMBER, 0); |
148 | 148 | } |
@@ -167,30 +167,30 @@ |
||
167 | 167 | { |
168 | 168 | switch($this->getType()) |
169 | 169 | { |
170 | - case self::JS_CALL: |
|
171 | - return $this->getValue()->toArray(); |
|
172 | - case self::JS_VALUE: |
|
173 | - return [ |
|
174 | - '_type' => 'expr', |
|
175 | - 'calls' => [['_type' => 'attr', '_name' => $this->getValue()]], |
|
176 | - ]; |
|
177 | - case self::FORM_VALUES: |
|
178 | - return ['_type' => 'form', '_name' => $this->getValue()]; |
|
179 | - case self::INPUT_VALUE: |
|
180 | - return ['_type' => 'input', '_name' => $this->getValue()]; |
|
181 | - case self::CHECKED_VALUE: |
|
182 | - return ['_type' => 'checked', '_name' => $this->getValue()]; |
|
183 | - case self::ELEMENT_INNERHTML: |
|
184 | - return ['_type' => 'html', '_name' => $this->getValue()]; |
|
185 | - case self::PAGE_NUMBER: |
|
186 | - return ['_type' => 'page', '_name' => '']; |
|
187 | - case self::QUOTED_VALUE: |
|
188 | - case self::BOOL_VALUE: |
|
189 | - case self::NUMERIC_VALUE: |
|
190 | - case self::JSON_VALUE: |
|
191 | - default: |
|
192 | - // Return the value as is. |
|
193 | - return $this->getValue(); |
|
170 | + case self::JS_CALL: |
|
171 | + return $this->getValue()->toArray(); |
|
172 | + case self::JS_VALUE: |
|
173 | + return [ |
|
174 | + '_type' => 'expr', |
|
175 | + 'calls' => [['_type' => 'attr', '_name' => $this->getValue()]], |
|
176 | + ]; |
|
177 | + case self::FORM_VALUES: |
|
178 | + return ['_type' => 'form', '_name' => $this->getValue()]; |
|
179 | + case self::INPUT_VALUE: |
|
180 | + return ['_type' => 'input', '_name' => $this->getValue()]; |
|
181 | + case self::CHECKED_VALUE: |
|
182 | + return ['_type' => 'checked', '_name' => $this->getValue()]; |
|
183 | + case self::ELEMENT_INNERHTML: |
|
184 | + return ['_type' => 'html', '_name' => $this->getValue()]; |
|
185 | + case self::PAGE_NUMBER: |
|
186 | + return ['_type' => 'page', '_name' => '']; |
|
187 | + case self::QUOTED_VALUE: |
|
188 | + case self::BOOL_VALUE: |
|
189 | + case self::NUMERIC_VALUE: |
|
190 | + case self::JSON_VALUE: |
|
191 | + default: |
|
192 | + // Return the value as is. |
|
193 | + return $this->getValue(); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 |
@@ -132,23 +132,23 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public static function make($xValue): ParameterInterface |
134 | 134 | { |
135 | - if($xValue instanceof ParameterInterface) |
|
135 | + if ($xValue instanceof ParameterInterface) |
|
136 | 136 | { |
137 | 137 | return $xValue; |
138 | 138 | } |
139 | - if(is_numeric($xValue)) |
|
139 | + if (is_numeric($xValue)) |
|
140 | 140 | { |
141 | 141 | return new Parameter(self::NUMERIC_VALUE, $xValue); |
142 | 142 | } |
143 | - if(is_string($xValue)) |
|
143 | + if (is_string($xValue)) |
|
144 | 144 | { |
145 | 145 | return new Parameter(self::QUOTED_VALUE, $xValue); |
146 | 146 | } |
147 | - if(is_bool($xValue)) |
|
147 | + if (is_bool($xValue)) |
|
148 | 148 | { |
149 | 149 | return new Parameter(self::BOOL_VALUE, $xValue); |
150 | 150 | } |
151 | - if($xValue instanceof Call) |
|
151 | + if ($xValue instanceof Call) |
|
152 | 152 | { |
153 | 153 | return new Parameter(self::JS_CALL, $xValue); |
154 | 154 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function jsonSerialize() |
167 | 167 | { |
168 | - switch($this->getType()) |
|
168 | + switch ($this->getType()) |
|
169 | 169 | { |
170 | 170 | case self::JS_CALL: |
171 | 171 | return $this->getValue()->toArray(); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | protected function getNumericValueScript(): string |
288 | 288 | { |
289 | - return (string)$this->xValue; |
|
289 | + return (string) $this->xValue; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | protected function getUnquotedValueScript(): string |
298 | 298 | { |
299 | - return (string)$this->xValue; |
|
299 | + return (string) $this->xValue; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | protected function getPageNumberScript(): string |
320 | 320 | { |
321 | - return (string)$this->xValue; |
|
321 | + return (string) $this->xValue; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | public function getScript(): string |
330 | 330 | { |
331 | 331 | $sMethodName = 'get' . $this->sType . 'Script'; |
332 | - if(!method_exists($this, $sMethodName)) |
|
332 | + if (!method_exists($this, $sMethodName)) |
|
333 | 333 | { |
334 | 334 | return ''; |
335 | 335 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function addParameters(array $aParameters): Call |
152 | 152 | { |
153 | - foreach($aParameters as $xParameter) |
|
153 | + foreach ($aParameters as $xParameter) |
|
154 | 154 | { |
155 | 155 | $this->pushParameter(Parameter::make($xParameter)); |
156 | 156 | } |
@@ -403,9 +403,9 @@ discard block |
||
403 | 403 | */ |
404 | 404 | private function findPageNumber(): ?ParameterInterface |
405 | 405 | { |
406 | - foreach($this->aParameters as $xParameter) |
|
406 | + foreach ($this->aParameters as $xParameter) |
|
407 | 407 | { |
408 | - if($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
408 | + if ($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
409 | 409 | { |
410 | 410 | return $xParameter; |
411 | 411 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | { |
435 | 435 | /** @var Parameter */ |
436 | 436 | $xParameter = $this->findPageNumber(); |
437 | - if($xParameter !== null) |
|
437 | + if ($xParameter !== null) |
|
438 | 438 | { |
439 | 439 | $xParameter->setValue($nPageNumber); |
440 | 440 | } |
@@ -455,25 +455,25 @@ discard block |
||
455 | 455 | return $xParam->jsonSerialize(); |
456 | 456 | }, $this->aParameters), |
457 | 457 | ]]; |
458 | - if($this->bToInt) |
|
458 | + if ($this->bToInt) |
|
459 | 459 | { |
460 | 460 | $aCalls[] = [ |
461 | 461 | '_type' => 'func', |
462 | 462 | '_name' => 'toInt', |
463 | - 'args' => [[ '_type' => '_', '_name' => 'this' ]], |
|
463 | + 'args' => [['_type' => '_', '_name' => 'this']], |
|
464 | 464 | ]; |
465 | 465 | } |
466 | 466 | |
467 | 467 | $aCall = ['_type' => 'expr', 'calls' => $aCalls]; |
468 | - if(($this->aConfirm)) |
|
468 | + if (($this->aConfirm)) |
|
469 | 469 | { |
470 | 470 | $aCall['question'] = $this->aConfirm; |
471 | 471 | } |
472 | - if(($this->aCondition)) |
|
472 | + if (($this->aCondition)) |
|
473 | 473 | { |
474 | 474 | $aCall['condition'] = $this->aCondition; |
475 | 475 | } |
476 | - if(($this->aMessage)) |
|
476 | + if (($this->aMessage)) |
|
477 | 477 | { |
478 | 478 | $aCall['message'] = $this->aMessage; |
479 | 479 | } |
@@ -162,19 +162,18 @@ discard block |
||
162 | 162 | private function getPathAsStr() |
163 | 163 | { |
164 | 164 | $jQuery = 'jaxon.jq'; // The JQuery selector |
165 | - if(!$this->sPath) |
|
165 | + if (!$this->sPath) |
|
166 | 166 | { |
167 | 167 | // If an empty selector is given, use the event target instead |
168 | 168 | return "$jQuery(e.currentTarget)"; |
169 | 169 | } |
170 | - if(!$this->xContext) |
|
170 | + if (!$this->xContext) |
|
171 | 171 | { |
172 | 172 | return "$jQuery('" . $this->sPath . "')"; |
173 | 173 | } |
174 | 174 | |
175 | 175 | $sContext = is_a($this->xContext, self::class) ? |
176 | - $this->xContext->getScript() : |
|
177 | - "$jQuery('" . trim("{$this->xContext}") . "')"; |
|
176 | + $this->xContext->getScript() : "$jQuery('" . trim("{$this->xContext}") . "')"; |
|
178 | 177 | return "$jQuery('{$this->sPath}', $sContext)"; |
179 | 178 | } |
180 | 179 | |
@@ -196,10 +195,10 @@ discard block |
||
196 | 195 | { |
197 | 196 | $sName = $this->sPath ?? 'this'; |
198 | 197 | $aCall = ['_type' => 'select', '_name' => $sName]; |
199 | - if(($this->xContext)) |
|
198 | + if (($this->xContext)) |
|
200 | 199 | { |
201 | 200 | $aCall['context'] = is_a($this->xContext, self::class) ? |
202 | - $this->xContext->jsonSerialize() :$this->xContext; |
|
201 | + $this->xContext->jsonSerialize() : $this->xContext; |
|
203 | 202 | } |
204 | 203 | return $aCall; |
205 | 204 | } |
@@ -210,16 +209,16 @@ discard block |
||
210 | 209 | public function toArray(): array |
211 | 210 | { |
212 | 211 | $aCalls = [$this->getPathAsArray()]; |
213 | - foreach($this->aCalls as $xCall) |
|
212 | + foreach ($this->aCalls as $xCall) |
|
214 | 213 | { |
215 | 214 | $aCalls[] = $xCall->jsonSerialize(); |
216 | 215 | } |
217 | - if($this->bToInt) |
|
216 | + if ($this->bToInt) |
|
218 | 217 | { |
219 | 218 | $aCalls[] = [ |
220 | 219 | '_type' => 'func', |
221 | 220 | '_name' => 'toInt', |
222 | - 'args' => [[ '_type' => '_', '_name' => 'this' ]], |
|
221 | + 'args' => [['_type' => '_', '_name' => 'this']], |
|
223 | 222 | ]; |
224 | 223 | } |
225 | 224 | return ['_type' => $this->getType(), 'calls' => $aCalls]; |