@@ -148,19 +148,18 @@ discard block |
||
| 148 | 148 | private function getPathAsStr() |
| 149 | 149 | { |
| 150 | 150 | $jQuery = 'jaxon.jq'; // The JQuery selector |
| 151 | - if(!$this->sPath) |
|
| 151 | + if (!$this->sPath) |
|
| 152 | 152 | { |
| 153 | 153 | // If an empty selector is given, use the event target instead |
| 154 | 154 | return "$jQuery(e.currentTarget)"; |
| 155 | 155 | } |
| 156 | - if(!$this->xContext) |
|
| 156 | + if (!$this->xContext) |
|
| 157 | 157 | { |
| 158 | 158 | return "$jQuery('" . $this->sPath . "')"; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $sContext = is_a($this->xContext, self::class) ? |
| 162 | - $this->xContext->getScript() : |
|
| 163 | - "$jQuery('" . trim("{$this->xContext}") . "')"; |
|
| 162 | + $this->xContext->getScript() : "$jQuery('" . trim("{$this->xContext}") . "')"; |
|
| 164 | 163 | return "$jQuery('{$this->sPath}', $sContext)"; |
| 165 | 164 | } |
| 166 | 165 | |
@@ -182,10 +181,10 @@ discard block |
||
| 182 | 181 | { |
| 183 | 182 | $sName = $this->sPath ?? 'this'; |
| 184 | 183 | $aCall = ['_type' => 'select', '_name' => $sName]; |
| 185 | - if(($this->xContext)) |
|
| 184 | + if (($this->xContext)) |
|
| 186 | 185 | { |
| 187 | 186 | $aCall['context'] = is_a($this->xContext, self::class) ? |
| 188 | - $this->xContext->jsonSerialize() :$this->xContext; |
|
| 187 | + $this->xContext->jsonSerialize() : $this->xContext; |
|
| 189 | 188 | } |
| 190 | 189 | return $aCall; |
| 191 | 190 | } |
@@ -198,11 +197,11 @@ discard block |
||
| 198 | 197 | public function jsonSerialize(): array |
| 199 | 198 | { |
| 200 | 199 | $aCalls = [$this->getPathAsArray()]; |
| 201 | - foreach($this->aCalls as $xCall) |
|
| 200 | + foreach ($this->aCalls as $xCall) |
|
| 202 | 201 | { |
| 203 | 202 | $aCalls[] = $xCall->jsonSerialize(); |
| 204 | 203 | } |
| 205 | - if($this->bToInt) |
|
| 204 | + if ($this->bToInt) |
|
| 206 | 205 | { |
| 207 | 206 | $aCalls[] = $this->toIntCall(); |
| 208 | 207 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function addParameters(array $aParameters): Call |
| 140 | 140 | { |
| 141 | - foreach($aParameters as $xParameter) |
|
| 141 | + foreach ($aParameters as $xParameter) |
|
| 142 | 142 | { |
| 143 | 143 | $this->pushParameter(Parameter::make($xParameter)); |
| 144 | 144 | } |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | private function findPageNumber(): ?ParameterInterface |
| 393 | 393 | { |
| 394 | - foreach($this->aParameters as $xParameter) |
|
| 394 | + foreach ($this->aParameters as $xParameter) |
|
| 395 | 395 | { |
| 396 | - if($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
| 396 | + if ($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
| 397 | 397 | { |
| 398 | 398 | return $xParameter; |
| 399 | 399 | } |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | { |
| 423 | 423 | /** @var Parameter */ |
| 424 | 424 | $xParameter = $this->findPageNumber(); |
| 425 | - if($xParameter !== null) |
|
| 425 | + if ($xParameter !== null) |
|
| 426 | 426 | { |
| 427 | 427 | $xParameter->setValue($nPageNumber); |
| 428 | 428 | } |
@@ -453,21 +453,21 @@ discard block |
||
| 453 | 453 | public function jsonSerialize(): array |
| 454 | 454 | { |
| 455 | 455 | $aCalls = [$this->toArray()]; |
| 456 | - if($this->bToInt) |
|
| 456 | + if ($this->bToInt) |
|
| 457 | 457 | { |
| 458 | 458 | $aCalls[] = $this->toIntCall(); |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | $aExpr = ['_type' => 'expr', 'calls' => $aCalls]; |
| 462 | - if(($this->aConfirm)) |
|
| 462 | + if (($this->aConfirm)) |
|
| 463 | 463 | { |
| 464 | 464 | $aExpr['question'] = $this->aConfirm; |
| 465 | 465 | } |
| 466 | - if(($this->aCondition)) |
|
| 466 | + if (($this->aCondition)) |
|
| 467 | 467 | { |
| 468 | 468 | $aExpr['condition'] = $this->aCondition; |
| 469 | 469 | } |
| 470 | - if(($this->aMessage)) |
|
| 470 | + if (($this->aMessage)) |
|
| 471 | 471 | { |
| 472 | 472 | $aExpr['message'] = $this->aMessage; |
| 473 | 473 | } |
@@ -167,30 +167,30 @@ |
||
| 167 | 167 | { |
| 168 | 168 | switch($this->getType()) |
| 169 | 169 | { |
| 170 | - case self::JS_CALL: |
|
| 171 | - return $this->getValue()->jsonSerialize(); |
|
| 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()->jsonSerialize(); |
|
| 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()->jsonSerialize(); |
@@ -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 | } |