@@ -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 | } |