@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public function onChange(Config $xConfig, string $sName) |
| 27 | 27 | { |
| 28 | 28 | // Set the library language any time the config is changed. |
| 29 | - if($sName === '' || $sName === 'core.language') |
|
| 29 | + if ($sName === '' || $sName === 'core.language') |
|
| 30 | 30 | { |
| 31 | 31 | $this->setLocale($xConfig->getOption('core.language')); |
| 32 | 32 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | { |
| 54 | 54 | $this->sDirectory = ''; |
| 55 | 55 | $this->sExtension = ''; |
| 56 | - if(isset($this->aDirectories[$sNamespace])) |
|
| 56 | + if (isset($this->aDirectories[$sNamespace])) |
|
| 57 | 57 | { |
| 58 | 58 | // Make sure there's only one '/' at the end of the string |
| 59 | 59 | $this->sDirectory = rtrim($this->aDirectories[$sNamespace]['path'], '/') . '/'; |
@@ -231,19 +231,19 @@ discard block |
||
| 231 | 231 | switch($sName) |
| 232 | 232 | { |
| 233 | 233 | // Set the methods to call before processing the request |
| 234 | - case '__before': |
|
| 235 | - $this->setHookMethods($this->aBeforeMethods, $xValue); |
|
| 236 | - break; |
|
| 237 | - // Set the methods to call after processing the request |
|
| 238 | - case '__after': |
|
| 239 | - $this->setHookMethods($this->aAfterMethods, $xValue); |
|
| 240 | - break; |
|
| 241 | - // Set the attributes to inject in the callable object |
|
| 242 | - case '__di': |
|
| 243 | - $this->addDiOption($xValue); |
|
| 244 | - break; |
|
| 245 | - default: |
|
| 246 | - break; |
|
| 234 | + case '__before': |
|
| 235 | + $this->setHookMethods($this->aBeforeMethods, $xValue); |
|
| 236 | + break; |
|
| 237 | + // Set the methods to call after processing the request |
|
| 238 | + case '__after': |
|
| 239 | + $this->setHookMethods($this->aAfterMethods, $xValue); |
|
| 240 | + break; |
|
| 241 | + // Set the attributes to inject in the callable object |
|
| 242 | + case '__di': |
|
| 243 | + $this->addDiOption($xValue); |
|
| 244 | + break; |
|
| 245 | + default: |
|
| 246 | + break; |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
@@ -291,20 +291,20 @@ discard block |
||
| 291 | 291 | { |
| 292 | 292 | switch($sOptionName) |
| 293 | 293 | { |
| 294 | - case 'excluded': |
|
| 295 | - if((bool)$xOptionValue) |
|
| 296 | - { |
|
| 297 | - $this->addProtectedMethods($sFunctionName); |
|
| 298 | - } |
|
| 299 | - break; |
|
| 300 | - // For databags, all the value are merged in a single array. |
|
| 301 | - case 'bags': |
|
| 302 | - $this->_addJsArrayOption($sFunctionName, $sOptionName, $xOptionValue); |
|
| 303 | - return; |
|
| 304 | - // For all the other options, including callback, only the last value is kept. |
|
| 305 | - case 'callback': |
|
| 306 | - default: |
|
| 307 | - $this->_setJsOption($sFunctionName, $sOptionName, $xOptionValue); |
|
| 294 | + case 'excluded': |
|
| 295 | + if((bool)$xOptionValue) |
|
| 296 | + { |
|
| 297 | + $this->addProtectedMethods($sFunctionName); |
|
| 298 | + } |
|
| 299 | + break; |
|
| 300 | + // For databags, all the value are merged in a single array. |
|
| 301 | + case 'bags': |
|
| 302 | + $this->_addJsArrayOption($sFunctionName, $sOptionName, $xOptionValue); |
|
| 303 | + return; |
|
| 304 | + // For all the other options, including callback, only the last value is kept. |
|
| 305 | + case 'callback': |
|
| 306 | + default: |
|
| 307 | + $this->_setJsOption($sFunctionName, $sOptionName, $xOptionValue); |
|
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
@@ -206,8 +206,7 @@ |
||
| 206 | 206 | if(is_array($xMethodToCall)) |
| 207 | 207 | { |
| 208 | 208 | $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall); |
| 209 | - } |
|
| 210 | - elseif(is_string($xMethodToCall)) |
|
| 209 | + } elseif(is_string($xMethodToCall)) |
|
| 211 | 210 | { |
| 212 | 211 | $aHookMethods[$sCalledMethod][] = $xMethodToCall; |
| 213 | 212 | } |
@@ -84,29 +84,29 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function __construct(array $aOptions, ?MetadataInterface $xMetadata) |
| 86 | 86 | { |
| 87 | - $this->bExcluded = ($xMetadata?->isExcluded() ?? false) || (bool)($aOptions['excluded'] ?? false); |
|
| 88 | - if($this->bExcluded) |
|
| 87 | + $this->bExcluded = ($xMetadata?->isExcluded() ?? false) || (bool) ($aOptions['excluded'] ?? false); |
|
| 88 | + if ($this->bExcluded) |
|
| 89 | 89 | { |
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $sSeparator = $aOptions['separator']; |
| 94 | - if($sSeparator === '_' || $sSeparator === '.') |
|
| 94 | + if ($sSeparator === '_' || $sSeparator === '.') |
|
| 95 | 95 | { |
| 96 | 96 | $this->sSeparator = $sSeparator; |
| 97 | 97 | } |
| 98 | 98 | $this->addProtectedMethods($aOptions['protected']); |
| 99 | 99 | $this->addProtectedMethods($xMetadata?->getProtectedMethods() ?? []); |
| 100 | 100 | |
| 101 | - foreach($aOptions['functions'] as $sNames => $aFunctionOptions) |
|
| 101 | + foreach ($aOptions['functions'] as $sNames => $aFunctionOptions) |
|
| 102 | 102 | { |
| 103 | 103 | $aFunctionNames = explode(',', $sNames); // Names are in comma-separated list. |
| 104 | - foreach($aFunctionNames as $sFunctionName) |
|
| 104 | + foreach ($aFunctionNames as $sFunctionName) |
|
| 105 | 105 | { |
| 106 | 106 | $this->addFunctionOptions($sFunctionName, $aFunctionOptions); |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | - foreach($xMetadata?->getProperties() ?? [] as $sFunctionName => $aFunctionOptions) |
|
| 109 | + foreach ($xMetadata?->getProperties() ?? [] as $sFunctionName => $aFunctionOptions) |
|
| 110 | 110 | { |
| 111 | 111 | $this->addFunctionOptions($sFunctionName, $aFunctionOptions); |
| 112 | 112 | } |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function addProtectedMethods($xMethods) |
| 121 | 121 | { |
| 122 | - if(!is_array($xMethods)) |
|
| 122 | + if (!is_array($xMethods)) |
|
| 123 | 123 | { |
| 124 | - $this->aProtectedMethods[trim((string)$xMethods)] = true; |
|
| 124 | + $this->aProtectedMethods[trim((string) $xMethods)] = true; |
|
| 125 | 125 | return; |
| 126 | 126 | } |
| 127 | - foreach($xMethods as $sMethod) |
|
| 127 | + foreach ($xMethods as $sMethod) |
|
| 128 | 128 | { |
| 129 | - $this->aProtectedMethods[trim((string)$sMethod)] = true; |
|
| 129 | + $this->aProtectedMethods[trim((string) $sMethod)] = true; |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
@@ -202,17 +202,17 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | private function setHookMethods(array &$aHookMethods, $xValue) |
| 204 | 204 | { |
| 205 | - foreach($xValue as $sCalledMethod => $xMethodToCall) |
|
| 205 | + foreach ($xValue as $sCalledMethod => $xMethodToCall) |
|
| 206 | 206 | { |
| 207 | - if(!isset($aHookMethods[$sCalledMethod])) |
|
| 207 | + if (!isset($aHookMethods[$sCalledMethod])) |
|
| 208 | 208 | { |
| 209 | 209 | $aHookMethods[$sCalledMethod] = []; |
| 210 | 210 | } |
| 211 | - if(is_array($xMethodToCall)) |
|
| 211 | + if (is_array($xMethodToCall)) |
|
| 212 | 212 | { |
| 213 | 213 | $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall); |
| 214 | 214 | } |
| 215 | - elseif(is_string($xMethodToCall)) |
|
| 215 | + elseif (is_string($xMethodToCall)) |
|
| 216 | 216 | { |
| 217 | 217 | $aHookMethods[$sCalledMethod][] = $xMethodToCall; |
| 218 | 218 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | private function addOption(string $sName, $xValue) |
| 239 | 239 | { |
| 240 | - switch($sName) |
|
| 240 | + switch ($sName) |
|
| 241 | 241 | { |
| 242 | 242 | // Set the methods to call before processing the request |
| 243 | 243 | case '__before': |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | private function _addJsArrayOption(string $sFunctionName, string $sOptionName, $xOptionValue) |
| 267 | 267 | { |
| 268 | - if(is_string($xOptionValue)) |
|
| 268 | + if (is_string($xOptionValue)) |
|
| 269 | 269 | { |
| 270 | 270 | $xOptionValue = [$xOptionValue]; |
| 271 | 271 | } |
| 272 | - if(!is_array($xOptionValue)) |
|
| 272 | + if (!is_array($xOptionValue)) |
|
| 273 | 273 | { |
| 274 | 274 | return; // Do not save. |
| 275 | 275 | } |
@@ -298,10 +298,10 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | private function addJsOption(string $sFunctionName, string $sOptionName, $xOptionValue) |
| 300 | 300 | { |
| 301 | - switch($sOptionName) |
|
| 301 | + switch ($sOptionName) |
|
| 302 | 302 | { |
| 303 | 303 | case 'excluded': |
| 304 | - if((bool)$xOptionValue) |
|
| 304 | + if ((bool) $xOptionValue) |
|
| 305 | 305 | { |
| 306 | 306 | $this->addProtectedMethods($sFunctionName); |
| 307 | 307 | } |
@@ -325,12 +325,11 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | private function addFunctionOptions(string $sFunctionName, array $aFunctionOptions) |
| 327 | 327 | { |
| 328 | - foreach($aFunctionOptions as $sOptionName => $xOptionValue) |
|
| 328 | + foreach ($aFunctionOptions as $sOptionName => $xOptionValue) |
|
| 329 | 329 | { |
| 330 | 330 | substr($sOptionName, 0, 2) === '__' ? |
| 331 | 331 | // Options for PHP classes. They start with "__". |
| 332 | - $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) : |
|
| 333 | - // Options for javascript code. |
|
| 332 | + $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) : // Options for javascript code. |
|
| 334 | 333 | $this->addJsOption($sFunctionName, $sOptionName, $xOptionValue); |
| 335 | 334 | } |
| 336 | 335 | } |
@@ -346,12 +345,11 @@ discard block |
||
| 346 | 345 | $aOptions = array_merge($this->aJsOptions['*'] ?? []); // Clone the array |
| 347 | 346 | // Then add the method options. |
| 348 | 347 | $aMethodOptions = $this->aJsOptions[$sMethodName] ?? []; |
| 349 | - foreach($aMethodOptions as $sOptionName => $xOptionValue) |
|
| 348 | + foreach ($aMethodOptions as $sOptionName => $xOptionValue) |
|
| 350 | 349 | { |
| 351 | 350 | // For databags, merge the values in a single array. |
| 352 | 351 | // For all the other options, including callback, keep the last value. |
| 353 | - $aOptions[$sOptionName] = $sOptionName !== 'bags' ? $xOptionValue : |
|
| 354 | - array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue)); |
|
| 352 | + $aOptions[$sOptionName] = $sOptionName !== 'bags' ? $xOptionValue : array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue)); |
|
| 355 | 353 | } |
| 356 | 354 | return $aOptions; |
| 357 | 355 | } |
@@ -193,8 +193,7 @@ |
||
| 193 | 193 | return $this->xAppContainer->get($sClass); |
| 194 | 194 | } |
| 195 | 195 | return $this->xLibContainer->offsetGet($sClass); |
| 196 | - } |
|
| 197 | - catch(Exception|Throwable $e) |
|
| 196 | + } catch(Exception|Throwable $e) |
|
| 198 | 197 | { |
| 199 | 198 | $xLogger = $this->g(LoggerInterface::class); |
| 200 | 199 | $xTranslator = $this->g(Translator::class); |
@@ -234,7 +234,7 @@ |
||
| 234 | 234 | */ |
| 235 | 235 | public function val(string $sKey, $xValue) |
| 236 | 236 | { |
| 237 | - $this->xLibContainer->offsetSet($sKey, $xValue); |
|
| 237 | + $this->xLibContainer->offsetSet($sKey, $xValue); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function has(string $sClass): bool |
| 160 | 160 | { |
| 161 | - if($this->xAppContainer != null && $this->xAppContainer->has($sClass)) |
|
| 161 | + if ($this->xAppContainer != null && $this->xAppContainer->has($sClass)) |
|
| 162 | 162 | { |
| 163 | 163 | return true; |
| 164 | 164 | } |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | { |
| 190 | 190 | try |
| 191 | 191 | { |
| 192 | - if($this->xAppContainer != null && $this->xAppContainer->has($sClass)) |
|
| 192 | + if ($this->xAppContainer != null && $this->xAppContainer->has($sClass)) |
|
| 193 | 193 | { |
| 194 | 194 | return $this->xAppContainer->get($sClass); |
| 195 | 195 | } |
| 196 | 196 | return $this->xLibContainer->offsetGet($sClass); |
| 197 | 197 | } |
| 198 | - catch(Exception|Throwable $e) |
|
| 198 | + catch (Exception | Throwable $e) |
|
| 199 | 199 | { |
| 200 | 200 | $xLogger = $this->g(LoggerInterface::class); |
| 201 | 201 | $xTranslator = $this->g(Translator::class); |
@@ -263,15 +263,15 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | $xType = $xParameter->getType(); |
| 265 | 265 | // Check the parameter class first. |
| 266 | - if($xType instanceof ReflectionNamedType) |
|
| 266 | + if ($xType instanceof ReflectionNamedType) |
|
| 267 | 267 | { |
| 268 | 268 | // Check the class + the name |
| 269 | - if($this->has($xType->getName() . ' $' . $xParameter->getName())) |
|
| 269 | + if ($this->has($xType->getName() . ' $' . $xParameter->getName())) |
|
| 270 | 270 | { |
| 271 | 271 | return $this->get($xType->getName() . ' $' . $xParameter->getName()); |
| 272 | 272 | } |
| 273 | 273 | // Check the class only |
| 274 | - if($this->has($xType->getName())) |
|
| 274 | + if ($this->has($xType->getName())) |
|
| 275 | 275 | { |
| 276 | 276 | return $this->get($xType->getName()); |
| 277 | 277 | } |
@@ -291,16 +291,16 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public function make($xClass) |
| 293 | 293 | { |
| 294 | - if(is_string($xClass)) |
|
| 294 | + if (is_string($xClass)) |
|
| 295 | 295 | { |
| 296 | 296 | $xClass = new ReflectionClass($xClass); // Create the reflection class instance |
| 297 | 297 | } |
| 298 | - if(!($xClass instanceof ReflectionClass)) |
|
| 298 | + if (!($xClass instanceof ReflectionClass)) |
|
| 299 | 299 | { |
| 300 | 300 | return null; |
| 301 | 301 | } |
| 302 | 302 | // Use the Reflection class to get the parameters of the constructor |
| 303 | - if(($constructor = $xClass->getConstructor()) === null) |
|
| 303 | + if (($constructor = $xClass->getConstructor()) === null) |
|
| 304 | 304 | { |
| 305 | 305 | return $xClass->newInstance(); |
| 306 | 306 | } |
@@ -211,8 +211,7 @@ |
||
| 211 | 211 | { |
| 212 | 212 | $this->xResponseManager->error($e->getMessage()); |
| 213 | 213 | $this->xCallbackManager->onInvalid($e); |
| 214 | - } |
|
| 215 | - catch(Exception $e) |
|
| 214 | + } catch(Exception $e) |
|
| 216 | 215 | { |
| 217 | 216 | $this->xResponseManager->error($e->getMessage()); |
| 218 | 217 | $this->xCallbackManager->onError($e); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public function canProcessRequest(): bool |
| 76 | 76 | { |
| 77 | 77 | // Return true if the request plugin was already found |
| 78 | - if($this->xRequestPlugin !== null) |
|
| 78 | + if ($this->xRequestPlugin !== null) |
|
| 79 | 79 | { |
| 80 | 80 | return true; |
| 81 | 81 | } |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | $xRequest = $this->di->getRequest(); |
| 85 | 85 | |
| 86 | 86 | // Find a plugin to process the request |
| 87 | - foreach($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
| 87 | + foreach ($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
| 88 | 88 | { |
| 89 | - if($sClassName::canProcessRequest($xRequest)) |
|
| 89 | + if ($sClassName::canProcessRequest($xRequest)) |
|
| 90 | 90 | { |
| 91 | 91 | $this->xRequestPlugin = $this->di->g($sClassName); |
| 92 | 92 | $xTarget = $this->xRequestPlugin->setTarget($xRequest); |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | // Process uploaded files, if the upload plugin is enabled |
| 112 | 112 | $xUploadHandler = $this->getUploadHandler(); |
| 113 | - if($xUploadHandler !== null && $xUploadHandler->canProcessRequest($xRequest)) |
|
| 113 | + if ($xUploadHandler !== null && $xUploadHandler->canProcessRequest($xRequest)) |
|
| 114 | 114 | { |
| 115 | 115 | $xUploadHandler->processRequest($xRequest); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // Process the request |
| 119 | - if(($this->xRequestPlugin)) |
|
| 119 | + if (($this->xRequestPlugin)) |
|
| 120 | 120 | { |
| 121 | 121 | $this->xRequestPlugin->processRequest(); |
| 122 | 122 | // Process the databag |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | public function processRequest() |
| 134 | 134 | { |
| 135 | 135 | // Check if there is a plugin to process this request |
| 136 | - if(!$this->canProcessRequest()) |
|
| 136 | + if (!$this->canProcessRequest()) |
|
| 137 | 137 | { |
| 138 | 138 | return; |
| 139 | 139 | } |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | { |
| 143 | 143 | $bEndRequest = false; |
| 144 | 144 | // Handle before processing event |
| 145 | - if(($this->xRequestPlugin)) |
|
| 145 | + if (($this->xRequestPlugin)) |
|
| 146 | 146 | { |
| 147 | 147 | $this->xCallbackManager->onBefore($this->xRequestPlugin->getTarget(), $bEndRequest); |
| 148 | 148 | } |
| 149 | - if($bEndRequest) |
|
| 149 | + if ($bEndRequest) |
|
| 150 | 150 | { |
| 151 | 151 | return; |
| 152 | 152 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $this->_processRequest(); |
| 155 | 155 | |
| 156 | 156 | // Handle after processing event |
| 157 | - if(($this->xRequestPlugin)) |
|
| 157 | + if (($this->xRequestPlugin)) |
|
| 158 | 158 | { |
| 159 | 159 | $this->xCallbackManager->onAfter($this->xRequestPlugin->getTarget(), $bEndRequest); |
| 160 | 160 | } |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | // An exception was thrown while processing the request. |
| 163 | 163 | // The request missed the corresponding handler function, |
| 164 | 164 | // or an error occurred while attempting to execute the handler. |
| 165 | - catch(RequestException $e) |
|
| 165 | + catch (RequestException $e) |
|
| 166 | 166 | { |
| 167 | 167 | $this->xResponseManager->error($e->getMessage()); |
| 168 | 168 | $this->xCallbackManager->onInvalid($e); |
| 169 | 169 | } |
| 170 | - catch(Exception $e) |
|
| 170 | + catch (Exception $e) |
|
| 171 | 171 | { |
| 172 | 172 | $this->xResponseManager->error($e->getMessage()); |
| 173 | 173 | $this->xCallbackManager->onError($e); |
@@ -6,7 +6,8 @@ discard block |
||
| 6 | 6 | if(<?php echo $sJsClass ?> === undefined) { |
| 7 | 7 | <?php echo $sJsClass ?> = {}; |
| 8 | 8 | } |
| 9 | -<?php else: ?> |
|
| 9 | +<?php else { |
|
| 10 | + : ?> |
|
| 10 | 11 | <?php echo $sJsClass ?> = {}; |
| 11 | 12 | <?php endif ?> |
| 12 | 13 | <?php foreach($this->aMethods as $aMethod): ?> |
@@ -17,3 +18,4 @@ discard block |
||
| 17 | 18 | echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> }); |
| 18 | 19 | }; |
| 19 | 20 | <?php endforeach; |
| 21 | +} |
|
@@ -2,18 +2,18 @@ |
||
| 2 | 2 | <?php |
| 3 | 3 | // An exported PHP class can have the same name as a subdir in the same parent dir. |
| 4 | 4 | // So, we must make sure that embedded js objects do not already exist, before we create them. |
| 5 | -if(strpos($sJsClass, '.') !== false): ?> |
|
| 5 | +if (strpos($sJsClass, '.') !== false): ?> |
|
| 6 | 6 | if(<?php echo $sJsClass ?> === undefined) { |
| 7 | 7 | <?php echo $sJsClass ?> = {}; |
| 8 | 8 | } |
| 9 | 9 | <?php else: ?> |
| 10 | 10 | <?php echo $sJsClass ?> = {}; |
| 11 | 11 | <?php endif ?> |
| 12 | -<?php foreach($this->aMethods as $aMethod): ?> |
|
| 12 | +<?php foreach ($this->aMethods as $aMethod): ?> |
|
| 13 | 13 | <?php echo $sJsClass ?>.<?php echo $aMethod['name'] ?> = function() { |
| 14 | 14 | return jaxon.request({ type: 'class', name: '<?php echo $this->sClass ?>', method: '<?php |
| 15 | 15 | echo $aMethod['name'] ?>' }, { parameters: arguments<?php |
| 16 | - foreach($aMethod['config'] as $sKey => $sValue): ?>, <?php |
|
| 16 | + foreach ($aMethod['config'] as $sKey => $sValue): ?>, <?php |
|
| 17 | 17 | echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> }); |
| 18 | 18 | }; |
| 19 | 19 | <?php endforeach; |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | */ |
| 61 | 61 | public function __get(string $sAttribute): JsExpr |
| 62 | 62 | { |
| 63 | - return $this->_expr()->__get( $sAttribute); |
|
| 63 | + return $this->_expr()->__get($sAttribute); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function func(): ?Func |
| 93 | 93 | { |
| 94 | - foreach($this->aCalls as $xCall) |
|
| 94 | + foreach ($this->aCalls as $xCall) |
|
| 95 | 95 | { |
| 96 | - if(is_a($xCall, Func::class)) |
|
| 96 | + if (is_a($xCall, Func::class)) |
|
| 97 | 97 | { |
| 98 | 98 | return $xCall; |
| 99 | 99 | } |
@@ -442,21 +442,21 @@ discard block |
||
| 442 | 442 | $aCalls = array_map(function(JsonSerializable $xCall) { |
| 443 | 443 | return $xCall->jsonSerialize(); |
| 444 | 444 | }, $this->aCalls); |
| 445 | - if($this->bToInt) |
|
| 445 | + if ($this->bToInt) |
|
| 446 | 446 | { |
| 447 | 447 | $aCalls[] = $this->toIntCall(); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | $aJsExpr = ['_type' => $this->getType(), 'calls' => $aCalls]; |
| 451 | - if(($this->aConfirm)) |
|
| 451 | + if (($this->aConfirm)) |
|
| 452 | 452 | { |
| 453 | 453 | $aJsExpr['question'] = $this->aConfirm; |
| 454 | 454 | } |
| 455 | - if(($this->aCondition)) |
|
| 455 | + if (($this->aCondition)) |
|
| 456 | 456 | { |
| 457 | 457 | $aJsExpr['condition'] = $this->aCondition; |
| 458 | 458 | } |
| 459 | - if(($this->aMessage)) |
|
| 459 | + if (($this->aMessage)) |
|
| 460 | 460 | { |
| 461 | 461 | $aJsExpr['message'] = $this->aMessage; |
| 462 | 462 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $sName = trim($sPath) ?: 'this'; |
| 33 | 33 | $this->aCall = ['_type' => 'select', '_name' => $sName, 'mode' => $sMode]; |
| 34 | - if(($sPath) && ($xContext)) |
|
| 34 | + if (($sPath) && ($xContext)) |
|
| 35 | 35 | { |
| 36 | 36 | $this->aCall['context'] = is_a($xContext, JsonSerializable::class) ? |
| 37 | 37 | $xContext->jsonSerialize() : $xContext; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | private function getPathAsStr(string $sPath, string $sMode, $xContext) |
| 53 | 53 | { |
| 54 | - if(!$xContext) |
|
| 54 | + if (!$xContext) |
|
| 55 | 55 | { |
| 56 | 56 | return $sMode === 'jq' ? "jaxon.jq('$sPath')" : $sPath; |
| 57 | 57 | } |