@@ -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 | } |
@@ -14,8 +14,8 @@ |
||
14 | 14 | * @link https://github.com/jaxon-php/jaxon-core |
15 | 15 | */ |
16 | 16 | |
17 | - use Jaxon\App\Dialog\DialogManager; |
|
18 | - use Jaxon\Exception\SetupException; |
|
17 | + use Jaxon\App\Dialog\DialogManager; |
|
18 | + use Jaxon\Exception\SetupException; |
|
19 | 19 | use Jaxon\Plugin\Request\CallableClass\CallableRegistry; |
20 | 20 | |
21 | 21 | use function trim; |
@@ -80,8 +80,7 @@ discard block |
||
80 | 80 | $sClassName = trim($sClassName); |
81 | 81 | // There is a single request factory for all callable functions, |
82 | 82 | // while each callable class has it own request factory. |
83 | - return !$sClassName ? $this->xRqFunctionFactory : |
|
84 | - $this->xCallableRegistry->getJsCallFactory($sClassName); |
|
83 | + return !$sClassName ? $this->xRqFunctionFactory : $this->xCallableRegistry->getJsCallFactory($sClassName); |
|
85 | 84 | } |
86 | 85 | |
87 | 86 | /** |
@@ -96,8 +95,7 @@ discard block |
||
96 | 95 | $sClassName = trim($sClassName); |
97 | 96 | // There is a single request factory for all js functions, |
98 | 97 | // while each js object has it own request factory. |
99 | - return !$sClassName ? $this->xJsFunctionFactory : |
|
100 | - new JsCallFactory($sClassName . '.', $this->xDialogManager); |
|
98 | + return !$sClassName ? $this->xJsFunctionFactory : new JsCallFactory($sClassName . '.', $this->xDialogManager); |
|
101 | 99 | } |
102 | 100 | |
103 | 101 | /** |
@@ -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 | } |
@@ -212,11 +211,11 @@ discard block |
||
212 | 211 | public function jsonSerialize(): array |
213 | 212 | { |
214 | 213 | $aCalls = [$this->getPathAsArray()]; |
215 | - foreach($this->aCalls as $xCall) |
|
214 | + foreach ($this->aCalls as $xCall) |
|
216 | 215 | { |
217 | 216 | $aCalls[] = $xCall->jsonSerialize(); |
218 | 217 | } |
219 | - if($this->bToInt) |
|
218 | + if ($this->bToInt) |
|
220 | 219 | { |
221 | 220 | $aCalls[] = [ |
222 | 221 | '_type' => 'method', |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function addParameters(array $aParameters): Call |
154 | 154 | { |
155 | - foreach($aParameters as $xParameter) |
|
155 | + foreach ($aParameters as $xParameter) |
|
156 | 156 | { |
157 | 157 | $this->pushParameter(Parameter::make($xParameter)); |
158 | 158 | } |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | */ |
406 | 406 | private function findPageNumber(): ?ParameterInterface |
407 | 407 | { |
408 | - foreach($this->aParameters as $xParameter) |
|
408 | + foreach ($this->aParameters as $xParameter) |
|
409 | 409 | { |
410 | - if($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
410 | + if ($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
411 | 411 | { |
412 | 412 | return $xParameter; |
413 | 413 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | { |
437 | 437 | /** @var Parameter */ |
438 | 438 | $xParameter = $this->findPageNumber(); |
439 | - if($xParameter !== null) |
|
439 | + if ($xParameter !== null) |
|
440 | 440 | { |
441 | 441 | $xParameter->setValue($nPageNumber); |
442 | 442 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | return $xParam->jsonSerialize(); |
458 | 458 | }, $this->aParameters), |
459 | 459 | ]]; |
460 | - if($this->bToInt) |
|
460 | + if ($this->bToInt) |
|
461 | 461 | { |
462 | 462 | $aCalls[] = [ |
463 | 463 | '_type' => 'method', |
@@ -467,15 +467,15 @@ discard block |
||
467 | 467 | } |
468 | 468 | |
469 | 469 | $aCall = ['_type' => 'expr', 'calls' => $aCalls]; |
470 | - if(($this->aConfirm)) |
|
470 | + if (($this->aConfirm)) |
|
471 | 471 | { |
472 | 472 | $aCall['question'] = $this->aConfirm; |
473 | 473 | } |
474 | - if(($this->aCondition)) |
|
474 | + if (($this->aCondition)) |
|
475 | 475 | { |
476 | 476 | $aCall['condition'] = $this->aCondition; |
477 | 477 | } |
478 | - if(($this->aMessage)) |
|
478 | + if (($this->aMessage)) |
|
479 | 479 | { |
480 | 480 | $aCall['message'] = $this->aMessage; |
481 | 481 | } |