@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function popBootCallbacks(): array |
| 100 | 100 | { |
| 101 | - if(empty($this->aBootCallbacks)) |
|
| 101 | + if (empty($this->aBootCallbacks)) |
|
| 102 | 102 | { |
| 103 | 103 | return []; |
| 104 | 104 | } |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | private function getExceptionCallbacks(Exception $xException): array |
| 118 | 118 | { |
| 119 | 119 | $aExceptionCallbacks = []; |
| 120 | - foreach($this->aExceptionCallbacks as $sExClass => $aCallbacks) |
|
| 120 | + foreach ($this->aExceptionCallbacks as $sExClass => $aCallbacks) |
|
| 121 | 121 | { |
| 122 | - if(is_a($xException, $sExClass)) |
|
| 122 | + if (is_a($xException, $sExClass)) |
|
| 123 | 123 | { |
| 124 | 124 | $aExceptionCallbacks = array_merge($aExceptionCallbacks, $aCallbacks); |
| 125 | 125 | } |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function error(callable $xCallable, string $sExClass = ''): CallbackManager |
| 191 | 191 | { |
| 192 | - if($sExClass === '' || $sExClass === Exception::class) |
|
| 192 | + if ($sExClass === '' || $sExClass === Exception::class) |
|
| 193 | 193 | { |
| 194 | 194 | $this->aErrorCallbacks[] = $xCallable; |
| 195 | 195 | return $this; |
| 196 | 196 | } |
| 197 | 197 | // Callback for a given exception class |
| 198 | - if(isset($this->aExceptionCallbacks[$sExClass])) |
|
| 198 | + if (isset($this->aExceptionCallbacks[$sExClass])) |
|
| 199 | 199 | { |
| 200 | 200 | $this->aExceptionCallbacks[$sExClass][] = $xCallable; |
| 201 | 201 | return $this; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | private function executeCallbacks(array $aCallbacks, array $aParameters): void |
| 238 | 238 | { |
| 239 | - foreach($aCallbacks as $xCallback) |
|
| 239 | + foreach ($aCallbacks as $xCallback) |
|
| 240 | 240 | { |
| 241 | 241 | $this->executeCallback($xCallback, $aParameters); |
| 242 | 242 | } |
@@ -266,10 +266,10 @@ discard block |
||
| 266 | 266 | public function onBefore(Target $xTarget, bool &$bEndRequest): void |
| 267 | 267 | { |
| 268 | 268 | // Call the user defined callback |
| 269 | - foreach($this->aBeforeCallbacks as $xCallback) |
|
| 269 | + foreach ($this->aBeforeCallbacks as $xCallback) |
|
| 270 | 270 | { |
| 271 | 271 | $this->executeCallback($xCallback, [$xTarget, &$bEndRequest]); |
| 272 | - if($bEndRequest) |
|
| 272 | + if ($bEndRequest) |
|
| 273 | 273 | { |
| 274 | 274 | return; |
| 275 | 275 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | $aExceptionCallbacks = $this->getExceptionCallbacks($xException); |
| 318 | 318 | $this->executeCallbacks($aExceptionCallbacks, [$xException]); |
| 319 | - if(count($aExceptionCallbacks) > 0) |
|
| 319 | + if (count($aExceptionCallbacks) > 0) |
|
| 320 | 320 | { |
| 321 | 321 | // Do not throw the exception if a custom handler is defined |
| 322 | 322 | return; |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | private function decoderUtf8Str(string $sStr): string |
| 81 | 81 | { |
| 82 | 82 | $sEncoding = $this->xConfigManager->getOption('core.encoding', ''); |
| 83 | - if(function_exists('iconv')) |
|
| 83 | + if (function_exists('iconv')) |
|
| 84 | 84 | { |
| 85 | 85 | return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr); |
| 86 | 86 | } |
| 87 | - if(function_exists('mb_convert_encoding')) |
|
| 87 | + if (function_exists('mb_convert_encoding')) |
|
| 88 | 88 | { |
| 89 | 89 | return mb_convert_encoding($sStr, $sEncoding, "UTF-8"); |
| 90 | 90 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | private function decodeRequestParameter(string $sParam): string |
| 104 | 104 | { |
| 105 | 105 | $sParam = $this->decodeStr($sParam); |
| 106 | - if(!$this->xConfigManager->getOption('core.decode_utf8')) |
|
| 106 | + if (!$this->xConfigManager->getOption('core.decode_utf8')) |
|
| 107 | 107 | { |
| 108 | 108 | return $sParam; |
| 109 | 109 | } |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function withPage(): self |
| 33 | 33 | { |
| 34 | - foreach($this->aArguments as $xArgument) |
|
| 34 | + foreach ($this->aArguments as $xArgument) |
|
| 35 | 35 | { |
| 36 | - if(TypedValue::isPage($xArgument)) |
|
| 36 | + if (TypedValue::isPage($xArgument)) |
|
| 37 | 37 | { |
| 38 | 38 | return $this; |
| 39 | 39 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $sName = trim($sPath) ?: 'this'; |
| 27 | 27 | $this->aCall = ['_type' => 'select', '_name' => $sName, 'mode' => $sMode]; |
| 28 | - if($sName !== 'this' && $xContext !== null) |
|
| 28 | + if ($sName !== 'this' && $xContext !== null) |
|
| 29 | 29 | { |
| 30 | 30 | $this->aCall['context'] = is_a($xContext, JsonSerializable::class) ? |
| 31 | 31 | $xContext->jsonSerialize() : $xContext; |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function func(): ?Func |
| 91 | 91 | { |
| 92 | - foreach($this->aCalls as $xCall) |
|
| 92 | + foreach ($this->aCalls as $xCall) |
|
| 93 | 93 | { |
| 94 | - if(is_a($xCall, Func::class)) |
|
| 94 | + if (is_a($xCall, Func::class)) |
|
| 95 | 95 | { |
| 96 | 96 | return $xCall; |
| 97 | 97 | } |
@@ -426,15 +426,15 @@ discard block |
||
| 426 | 426 | 'calls' => array_map(fn(JsonSerializable|array $xCall) => |
| 427 | 427 | is_array($xCall) ? $xCall : $xCall->jsonSerialize(), $this->aCalls), |
| 428 | 428 | ]; |
| 429 | - if(($this->aConfirm)) |
|
| 429 | + if (($this->aConfirm)) |
|
| 430 | 430 | { |
| 431 | 431 | $aJsExpr['confirm'] = $this->aConfirm; |
| 432 | 432 | } |
| 433 | - if(($this->aCondition)) |
|
| 433 | + if (($this->aCondition)) |
|
| 434 | 434 | { |
| 435 | 435 | $aJsExpr['condition'] = $this->aCondition; |
| 436 | 436 | } |
| 437 | - if(($this->aAlert)) |
|
| 437 | + if (($this->aAlert)) |
|
| 438 | 438 | { |
| 439 | 439 | $aJsExpr['alert'] = $this->aAlert; |
| 440 | 440 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function __get(string $sAttribute): JsExpr |
| 60 | 60 | { |
| 61 | - return $this->_expr()->__get( $sAttribute); |
|
| 61 | + return $this->_expr()->__get($sAttribute); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | Dialog\Library\Butterup::class, // Butterup |
| 56 | 56 | Dialog\Library\IziToast::class, // IziToast |
| 57 | 57 | ]; |
| 58 | - foreach($aLibraries as $sClass) |
|
| 58 | + foreach ($aLibraries as $sClass) |
|
| 59 | 59 | { |
| 60 | 60 | try |
| 61 | 61 | { |
| 62 | 62 | $xDialog->registerLibrary($sClass, $sClass::NAME); |
| 63 | 63 | } |
| 64 | - catch(SetupException $_){} |
|
| 64 | + catch (SetupException $_) {} |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return $xDialog; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | function register(): void |
| 80 | 80 | { |
| 81 | 81 | // Do nothing if running in cli. |
| 82 | - if(php_sapi_name() !== 'cli') |
|
| 82 | + if (php_sapi_name() !== 'cli') |
|
| 83 | 83 | { |
| 84 | 84 | _register(); |
| 85 | 85 | }; |
@@ -142,15 +142,15 @@ discard block |
||
| 142 | 142 | 'defaults' => $this->xConfigManager->getAppOption('dialogs.default', []), |
| 143 | 143 | ]; |
| 144 | 144 | $aLibrariesOptions = []; |
| 145 | - foreach($this->getLibraries() as $xLibrary) |
|
| 145 | + foreach ($this->getLibraries() as $xLibrary) |
|
| 146 | 146 | { |
| 147 | 147 | $aLibOptions = $xLibrary->helper()->getJsOptions(); |
| 148 | - if(count($aLibOptions) > 0) |
|
| 148 | + if (count($aLibOptions) > 0) |
|
| 149 | 149 | { |
| 150 | 150 | $aLibrariesOptions[$xLibrary->getName()] = $aLibOptions; |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | - if(count($aLibrariesOptions) > 0) |
|
| 153 | + if (count($aLibrariesOptions) > 0) |
|
| 154 | 154 | { |
| 155 | 155 | $aOptions['options'] = $aLibrariesOptions; |
| 156 | 156 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $xJsCode->sJsBefore = $this->getConfigScript(); |
| 168 | 168 | |
| 169 | 169 | $aCodes = []; |
| 170 | - foreach($this->getHelpers() as $xHelper) |
|
| 170 | + foreach ($this->getHelpers() as $xHelper) |
|
| 171 | 171 | { |
| 172 | 172 | $aCodes[] = $xHelper->getScript(); |
| 173 | 173 | $xJsCode->aFiles = array_merge($xJsCode->aFiles, $xHelper->getFiles()); |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function helper(): LibraryHelper |
| 57 | 57 | { |
| 58 | - return $this->xHelper ?: |
|
| 59 | - $this->xHelper = dialog()->getLibraryHelper($this->getName()); |
|
| 58 | + return $this->xHelper ?: $this->xHelper = dialog()->getLibraryHelper($this->getName()); |
|
| 60 | 59 | } |
| 61 | 60 | |
| 62 | 61 | /** |