@@ -331,16 +331,16 @@ |
||
| 331 | 331 | $sPrefix = substr($sName, 0, 15); |
| 332 | 332 | switch($sPrefix) |
| 333 | 333 | { |
| 334 | - case 'dialogs.default': |
|
| 335 | - $this->setDefaultLibraries(); |
|
| 336 | - return; |
|
| 337 | - case 'dialogs.lib.ext': |
|
| 338 | - $this->registerLibraries(); |
|
| 339 | - return; |
|
| 340 | - case 'dialogs.lib.use': |
|
| 341 | - $this->setUsedLibraries(); |
|
| 342 | - return; |
|
| 343 | - default: |
|
| 334 | + case 'dialogs.default': |
|
| 335 | + $this->setDefaultLibraries(); |
|
| 336 | + return; |
|
| 337 | + case 'dialogs.lib.ext': |
|
| 338 | + $this->registerLibraries(); |
|
| 339 | + return; |
|
| 340 | + case 'dialogs.lib.use': |
|
| 341 | + $this->setUsedLibraries(); |
|
| 342 | + return; |
|
| 343 | + default: |
|
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | } |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function registerLibrary(string $sClassName, string $sLibraryName) |
| 108 | 108 | { |
| 109 | - if(isset($this->aLibraries[$sLibraryName])) |
|
| 109 | + if (isset($this->aLibraries[$sLibraryName])) |
|
| 110 | 110 | { |
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | - if(!($aInterfaces = class_implements($sClassName))) |
|
| 113 | + if (!($aInterfaces = class_implements($sClassName))) |
|
| 114 | 114 | { |
| 115 | 115 | // The class is invalid. |
| 116 | 116 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $bIsQuestion = in_array(QuestionInterface::class, $aInterfaces); |
| 121 | 121 | $bIsMessage = in_array(MessageInterface::class, $aInterfaces); |
| 122 | 122 | $bIsModal = in_array(ModalInterface::class, $aInterfaces); |
| 123 | - if(!$bIsQuestion && !$bIsMessage && !$bIsModal) |
|
| 123 | + if (!$bIsQuestion && !$bIsMessage && !$bIsModal) |
|
| 124 | 124 | { |
| 125 | 125 | // The class is invalid. |
| 126 | 126 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function setQuestionLibrary(string $sLibraryName) |
| 150 | 150 | { |
| 151 | - if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['question']) |
|
| 151 | + if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['question']) |
|
| 152 | 152 | { |
| 153 | 153 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
| 154 | 154 | ['type' => 'question', 'name' => $sLibraryName]); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function setMessageLibrary(string $sLibraryName) |
| 179 | 179 | { |
| 180 | - if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['message']) |
|
| 180 | + if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['message']) |
|
| 181 | 181 | { |
| 182 | 182 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
| 183 | 183 | ['type' => 'message', 'name' => $sLibraryName]); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function setModalLibrary(string $sLibraryName) |
| 208 | 208 | { |
| 209 | - if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal']) |
|
| 209 | + if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal']) |
|
| 210 | 210 | { |
| 211 | 211 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
| 212 | 212 | ['type' => 'modal', 'name' => $sLibraryName]); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | protected function registerLibraries() |
| 247 | 247 | { |
| 248 | 248 | $aLibraries = $this->xConfigManager->getOption('dialogs.lib.ext', []); |
| 249 | - foreach($aLibraries as $sLibraryName => $sClassName) |
|
| 249 | + foreach ($aLibraries as $sLibraryName => $sClassName) |
|
| 250 | 250 | { |
| 251 | 251 | $this->registerLibrary($sClassName, $sLibraryName); |
| 252 | 252 | } |
@@ -261,19 +261,19 @@ discard block |
||
| 261 | 261 | protected function setDefaultLibraries() |
| 262 | 262 | { |
| 263 | 263 | // Set the default modal library |
| 264 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', ''))) |
|
| 264 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', ''))) |
|
| 265 | 265 | { |
| 266 | 266 | $this->setModalLibrary($sLibraryName); |
| 267 | 267 | $this->aLibraries[$sLibraryName]['used'] = true; |
| 268 | 268 | } |
| 269 | 269 | // Set the default message library |
| 270 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', ''))) |
|
| 270 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', ''))) |
|
| 271 | 271 | { |
| 272 | 272 | $this->setMessageLibrary($sLibraryName); |
| 273 | 273 | $this->aLibraries[$sLibraryName]['used'] = true; |
| 274 | 274 | } |
| 275 | 275 | // Set the default question library |
| 276 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', ''))) |
|
| 276 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', ''))) |
|
| 277 | 277 | { |
| 278 | 278 | $this->setQuestionLibrary($sLibraryName); |
| 279 | 279 | $this->aLibraries[$sLibraryName]['used'] = true; |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | { |
| 290 | 290 | // Set the other libraries in use |
| 291 | 291 | $aLibraries = $this->xConfigManager->getOption('dialogs.lib.use', []); |
| 292 | - foreach($aLibraries as $sLibraryName) |
|
| 292 | + foreach ($aLibraries as $sLibraryName) |
|
| 293 | 293 | { |
| 294 | - if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists |
|
| 294 | + if (isset($this->aLibraries[$sLibraryName])) // Make sure the library exists |
|
| 295 | 295 | { |
| 296 | 296 | $this->aLibraries[$sLibraryName]['used'] = true; |
| 297 | 297 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | public function onChange(Config $xConfig, string $sName) |
| 322 | 322 | { |
| 323 | - if($sName === '') |
|
| 323 | + if ($sName === '') |
|
| 324 | 324 | { |
| 325 | 325 | // Reset the default libraries any time the config is changed. |
| 326 | 326 | $this->registerLibraries(); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | return; |
| 330 | 330 | } |
| 331 | 331 | $sPrefix = substr($sName, 0, 15); |
| 332 | - switch($sPrefix) |
|
| 332 | + switch ($sPrefix) |
|
| 333 | 333 | { |
| 334 | 334 | case 'dialogs.default': |
| 335 | 335 | $this->setDefaultLibraries(); |
@@ -291,10 +291,12 @@ |
||
| 291 | 291 | $aLibraries = $this->xConfigManager->getOption('dialogs.lib.use', []); |
| 292 | 292 | foreach($aLibraries as $sLibraryName) |
| 293 | 293 | { |
| 294 | - if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists |
|
| 294 | + if(isset($this->aLibraries[$sLibraryName])) { |
|
| 295 | + // Make sure the library exists |
|
| 295 | 296 | { |
| 296 | 297 | $this->aLibraries[$sLibraryName]['used'] = true; |
| 297 | 298 | } |
| 299 | + } |
|
| 298 | 300 | } |
| 299 | 301 | } |
| 300 | 302 | |
@@ -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'], '/') . '/'; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function clear() |
| 81 | 81 | { |
| 82 | - if($this->xResponse !== null) |
|
| 82 | + if ($this->xResponse !== null) |
|
| 83 | 83 | { |
| 84 | 84 | $this->xResponse->clearCommands(); |
| 85 | 85 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function getResponse(): ResponseInterface |
| 95 | 95 | { |
| 96 | - if(!$this->xResponse) |
|
| 96 | + if (!$this->xResponse) |
|
| 97 | 97 | { |
| 98 | 98 | $this->xResponse = $this->di->getResponse(); |
| 99 | 99 | } |
@@ -114,21 +114,21 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function append(ResponseInterface $xResponse) |
| 116 | 116 | { |
| 117 | - if(!$this->xResponse) |
|
| 117 | + if (!$this->xResponse) |
|
| 118 | 118 | { |
| 119 | 119 | $this->xResponse = $this->di->getResponse(); |
| 120 | 120 | } |
| 121 | - if($this->xResponse->getCommandCount() === 0) |
|
| 121 | + if ($this->xResponse->getCommandCount() === 0) |
|
| 122 | 122 | { |
| 123 | 123 | $this->xResponse = $xResponse; |
| 124 | 124 | return; |
| 125 | 125 | } |
| 126 | - if(get_class($this->xResponse) !== get_class($xResponse)) |
|
| 126 | + if (get_class($this->xResponse) !== get_class($xResponse)) |
|
| 127 | 127 | { |
| 128 | 128 | throw new RequestException($this->xTranslator->trans('errors.mismatch.types', |
| 129 | 129 | ['class' => get_class($xResponse)])); |
| 130 | 130 | } |
| 131 | - if($this->xResponse !== $xResponse) |
|
| 131 | + if ($this->xResponse !== $xResponse) |
|
| 132 | 132 | { |
| 133 | 133 | $this->xResponse->appendResponse($xResponse); |
| 134 | 134 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function printDebug() |
| 171 | 171 | { |
| 172 | - foreach($this->aDebugMessages as $sMessage) |
|
| 172 | + foreach ($this->aDebugMessages as $sMessage) |
|
| 173 | 173 | { |
| 174 | 174 | $this->getResponse()->debug($sMessage); |
| 175 | 175 | } |
@@ -183,8 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function getContentType(): string |
| 185 | 185 | { |
| 186 | - return empty($this->sCharacterEncoding) ? $this->getResponse()->getContentType() : |
|
| 187 | - $this->getResponse()->getContentType() . '; charset="' . $this->sCharacterEncoding . '"'; |
|
| 186 | + return empty($this->sCharacterEncoding) ? $this->getResponse()->getContentType() : $this->getResponse()->getContentType() . '; charset="' . $this->sCharacterEncoding . '"'; |
|
| 188 | 187 | } |
| 189 | 188 | |
| 190 | 189 | /** |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | public function selector(string $sPath = '', $xContext = null): DomSelector |
| 88 | 88 | { |
| 89 | 89 | $xSelector = new DomSelector($this->jQueryNs, $sPath, $xContext); |
| 90 | - if($this->bCommand && $this->response() !== null) |
|
| 90 | + if ($this->bCommand && $this->response() !== null) |
|
| 91 | 91 | { |
| 92 | 92 | $this->addCommand(['cmd' => 'jquery'], $xSelector); |
| 93 | 93 | } |
@@ -136,18 +136,18 @@ discard block |
||
| 136 | 136 | $aOptions = $this->getOptionNames($sKeyPrefix); |
| 137 | 137 | $sSpaces = str_repeat(' ', $nSpaces); |
| 138 | 138 | $sScript = ''; |
| 139 | - foreach($aOptions as $sShortName => $sFullName) |
|
| 139 | + foreach ($aOptions as $sShortName => $sFullName) |
|
| 140 | 140 | { |
| 141 | 141 | $value = $this->xConfigManager->getOption($sFullName); |
| 142 | - if(is_string($value)) |
|
| 142 | + if (is_string($value)) |
|
| 143 | 143 | { |
| 144 | 144 | $value = "'$value'"; |
| 145 | 145 | } |
| 146 | - elseif(is_bool($value)) |
|
| 146 | + elseif (is_bool($value)) |
|
| 147 | 147 | { |
| 148 | 148 | $value = ($value ? 'true' : 'false'); |
| 149 | 149 | } |
| 150 | - elseif(!is_numeric($value)) |
|
| 150 | + elseif (!is_numeric($value)) |
|
| 151 | 151 | { |
| 152 | 152 | $value = json_encode($value); |
| 153 | 153 | } |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function getJsCode(string $sFile): string |
| 177 | 177 | { |
| 178 | - if($this->hasOption('assets.js')) |
|
| 178 | + if ($this->hasOption('assets.js')) |
|
| 179 | 179 | { |
| 180 | 180 | // If this expression evaluates to false, then the asset is not displayed. |
| 181 | - if(!($sUri = $this->getOption('assets.js'))) |
|
| 181 | + if (!($sUri = $this->getOption('assets.js'))) |
|
| 182 | 182 | { |
| 183 | 183 | return ''; |
| 184 | 184 | } |
@@ -200,10 +200,10 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function getCssCode(string $sFile): string |
| 202 | 202 | { |
| 203 | - if($this->hasOption('assets.css')) |
|
| 203 | + if ($this->hasOption('assets.css')) |
|
| 204 | 204 | { |
| 205 | 205 | // If this expression evaluates to false, then the asset is not displayed. |
| 206 | - if(!($sUri = $this->getOption('assets.css'))) |
|
| 206 | + if (!($sUri = $this->getOption('assets.css'))) |
|
| 207 | 207 | { |
| 208 | 208 | return ''; |
| 209 | 209 | } |
@@ -142,12 +142,10 @@ discard block |
||
| 142 | 142 | if(is_string($value)) |
| 143 | 143 | { |
| 144 | 144 | $value = "'$value'"; |
| 145 | - } |
|
| 146 | - elseif(is_bool($value)) |
|
| 145 | + } elseif(is_bool($value)) |
|
| 147 | 146 | { |
| 148 | 147 | $value = ($value ? 'true' : 'false'); |
| 149 | - } |
|
| 150 | - elseif(!is_numeric($value)) |
|
| 148 | + } elseif(!is_numeric($value)) |
|
| 151 | 149 | { |
| 152 | 150 | $value = json_encode($value); |
| 153 | 151 | } |
@@ -182,8 +180,7 @@ discard block |
||
| 182 | 180 | { |
| 183 | 181 | return ''; |
| 184 | 182 | } |
| 185 | - } |
|
| 186 | - else |
|
| 183 | + } else |
|
| 187 | 184 | { |
| 188 | 185 | $sUri = $this->sUri . '/' . ($this->sSubDir ? $this->sSubDir . '/' : '') . |
| 189 | 186 | ($this->sVersion ? $this->sVersion . '/' : '') . $sFile; |
@@ -207,8 +204,7 @@ discard block |
||
| 207 | 204 | { |
| 208 | 205 | return ''; |
| 209 | 206 | } |
| 210 | - } |
|
| 211 | - else |
|
| 207 | + } else |
|
| 212 | 208 | { |
| 213 | 209 | $sUri = $this->sUri . '/' . ($this->sSubDir ? $this->sSubDir . '/' : '') . |
| 214 | 210 | ($this->sVersion ? $this->sVersion . '/' : '') . $sFile; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $this->xRepository = $xRepository; |
| 90 | 90 | |
| 91 | 91 | // Set the composer autoloader |
| 92 | - if(file_exists(($sAutoloadFile = __DIR__ . '/../../../../../../autoload.php')) || |
|
| 92 | + if (file_exists(($sAutoloadFile = __DIR__ . '/../../../../../../autoload.php')) || |
|
| 93 | 93 | file_exists(($sAutoloadFile = __DIR__ . '/../../../../vendor/autoload.php'))) |
| 94 | 94 | { |
| 95 | 95 | $this->xAutoloader = require($sAutoloadFile); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | public function addDirectory(string $sDirectory, array $aOptions) |
| 107 | 107 | { |
| 108 | 108 | // Set the autoload option default value |
| 109 | - if(!isset($aOptions['autoload'])) |
|
| 109 | + if (!isset($aOptions['autoload'])) |
|
| 110 | 110 | { |
| 111 | 111 | $aOptions['autoload'] = true; |
| 112 | 112 | } |
@@ -123,26 +123,26 @@ discard block |
||
| 123 | 123 | public function addNamespace(string $sNamespace, array $aOptions) |
| 124 | 124 | { |
| 125 | 125 | // Separator default value |
| 126 | - if(!isset($aOptions['separator'])) |
|
| 126 | + if (!isset($aOptions['separator'])) |
|
| 127 | 127 | { |
| 128 | 128 | $aOptions['separator'] = '.'; |
| 129 | 129 | } |
| 130 | 130 | $aOptions['separator'] = trim($aOptions['separator']); |
| 131 | - if(!in_array($aOptions['separator'], ['.', '_'])) |
|
| 131 | + if (!in_array($aOptions['separator'], ['.', '_'])) |
|
| 132 | 132 | { |
| 133 | 133 | $aOptions['separator'] = '.'; |
| 134 | 134 | } |
| 135 | - if($aOptions['separator'] === '_') |
|
| 135 | + if ($aOptions['separator'] === '_') |
|
| 136 | 136 | { |
| 137 | 137 | $this->bUsingUnderscore = true; |
| 138 | 138 | } |
| 139 | 139 | // Set the autoload option default value |
| 140 | - if(!isset($aOptions['autoload'])) |
|
| 140 | + if (!isset($aOptions['autoload'])) |
|
| 141 | 141 | { |
| 142 | 142 | $aOptions['autoload'] = true; |
| 143 | 143 | } |
| 144 | 144 | // Register the dir with PSR4 autoloading |
| 145 | - if(($aOptions['autoload']) && $this->xAutoloader != null) |
|
| 145 | + if (($aOptions['autoload']) && $this->xAutoloader != null) |
|
| 146 | 146 | { |
| 147 | 147 | $this->xAutoloader->setPsr4($sNamespace . '\\', $aOptions['directory']); |
| 148 | 148 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | public function parseDirectories() |
| 158 | 158 | { |
| 159 | 159 | // This is to be done only once. |
| 160 | - if($this->bDirectoriesParsed) |
|
| 160 | + if ($this->bDirectoriesParsed) |
|
| 161 | 161 | { |
| 162 | 162 | return; |
| 163 | 163 | } |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | // Browse directories without namespaces and read all the files. |
| 167 | 167 | $aClassMap = []; |
| 168 | - foreach($this->xRepository->getDirectoryOptions() as $sDirectory => $aOptions) |
|
| 168 | + foreach ($this->xRepository->getDirectoryOptions() as $sDirectory => $aOptions) |
|
| 169 | 169 | { |
| 170 | 170 | $itFile = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($sDirectory)); |
| 171 | 171 | // Iterate on dir content |
| 172 | - foreach($itFile as $xFile) |
|
| 172 | + foreach ($itFile as $xFile) |
|
| 173 | 173 | { |
| 174 | 174 | // Skip everything except PHP files |
| 175 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 175 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 176 | 176 | { |
| 177 | 177 | continue; |
| 178 | 178 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $sClassName = $xFile->getBasename('.php'); |
| 181 | 181 | $aClassOptions = ['timestamp' => $xFile->getMTime()]; |
| 182 | 182 | // No more custom classmap autoloading. The file will be included when needed. |
| 183 | - if(($aOptions['autoload'])) |
|
| 183 | + if (($aOptions['autoload'])) |
|
| 184 | 184 | { |
| 185 | 185 | $aClassMap[$sClassName] = $xFile->getPathname(); |
| 186 | 186 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | // Set classmap autoloading |
| 191 | - if(($aClassMap) && $this->xAutoloader !== null) |
|
| 191 | + if (($aClassMap) && $this->xAutoloader !== null) |
|
| 192 | 192 | { |
| 193 | 193 | $this->xAutoloader->addClassMap($aClassMap); |
| 194 | 194 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | public function parseNamespaces() |
| 203 | 203 | { |
| 204 | 204 | // This is to be done only once. |
| 205 | - if($this->bNamespacesParsed) |
|
| 205 | + if ($this->bNamespacesParsed) |
|
| 206 | 206 | { |
| 207 | 207 | return; |
| 208 | 208 | } |
@@ -210,17 +210,17 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | // Browse directories with namespaces and read all the files. |
| 212 | 212 | $sDS = DIRECTORY_SEPARATOR; |
| 213 | - foreach($this->xRepository->getNamespaceOptions() as $sNamespace => $aOptions) |
|
| 213 | + foreach ($this->xRepository->getNamespaceOptions() as $sNamespace => $aOptions) |
|
| 214 | 214 | { |
| 215 | 215 | $this->xRepository->addNamespace($sNamespace, ['separator' => $aOptions['separator']]); |
| 216 | 216 | |
| 217 | 217 | // Iterate on dir content |
| 218 | 218 | $sDirectory = $aOptions['directory']; |
| 219 | 219 | $itFile = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($sDirectory)); |
| 220 | - foreach($itFile as $xFile) |
|
| 220 | + foreach ($itFile as $xFile) |
|
| 221 | 221 | { |
| 222 | 222 | // skip everything except PHP files |
| 223 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 223 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 224 | 224 | { |
| 225 | 225 | continue; |
| 226 | 226 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $sClassPath = $sNamespace; |
| 230 | 230 | $sRelativePath = substr($xFile->getPath(), strlen($sDirectory)); |
| 231 | 231 | $sRelativePath = trim(str_replace($sDS, '\\', $sRelativePath), '\\'); |
| 232 | - if($sRelativePath !== '') |
|
| 232 | + if ($sRelativePath !== '') |
|
| 233 | 233 | { |
| 234 | 234 | $sClassPath .= '\\' . $sRelativePath; |
| 235 | 235 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | // Replace all separators ('.' and '_') with antislashes, and remove the antislashes |
| 257 | 257 | // at the beginning and the end of the class name. |
| 258 | 258 | $sClassName = trim(str_replace('.', '\\', $sClassName), '\\'); |
| 259 | - if($this->bUsingUnderscore) |
|
| 259 | + if ($this->bUsingUnderscore) |
|
| 260 | 260 | { |
| 261 | 261 | $sClassName = trim(str_replace('_', '\\', $sClassName), '\\'); |
| 262 | 262 | } |
@@ -111,10 +111,12 @@ discard block |
||
| 111 | 111 | $sReflectionClass = $sClassName . '_ReflectionClass'; |
| 112 | 112 | |
| 113 | 113 | // Prevent duplication |
| 114 | - if($this->h($sReflectionClass)) // It's important not to use the class name here. |
|
| 114 | + if($this->h($sReflectionClass)) { |
|
| 115 | + // It's important not to use the class name here. |
|
| 115 | 116 | { |
| 116 | 117 | return; |
| 117 | 118 | } |
| 119 | + } |
|
| 118 | 120 | |
| 119 | 121 | // Make sure the registered class exists |
| 120 | 122 | if(isset($aOptions['include'])) |
@@ -125,8 +127,7 @@ discard block |
||
| 125 | 127 | try |
| 126 | 128 | { |
| 127 | 129 | $this->val($sReflectionClass, new ReflectionClass($sClassName)); |
| 128 | - } |
|
| 129 | - catch(ReflectionException $e) |
|
| 130 | + } catch(ReflectionException $e) |
|
| 130 | 131 | { |
| 131 | 132 | $xTranslator = $this->g(Translator::class); |
| 132 | 133 | $sMessage = $xTranslator->trans('errors.class.invalid', ['name' => $sClassName]); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | private function setDiAttributes($xRegisteredObject, array $aDiOptions) |
| 35 | 35 | { |
| 36 | - foreach($aDiOptions as $sName => $sClass) |
|
| 36 | + foreach ($aDiOptions as $sName => $sClass) |
|
| 37 | 37 | { |
| 38 | 38 | // Set the protected attributes of the object |
| 39 | 39 | $cSetter = function($xInjectedObject) use($sName) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $this->setDiAttributes($xRegisteredObject, $aDiOptions); |
| 64 | 64 | |
| 65 | 65 | // Set the Jaxon request target in the helper |
| 66 | - if($xRegisteredObject instanceof CallableClass) |
|
| 66 | + if ($xRegisteredObject instanceof CallableClass) |
|
| 67 | 67 | { |
| 68 | 68 | // Set the protected attributes of the object |
| 69 | 69 | $cSetter = function() use($xTarget) { |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | $sReflectionClass = $sClassName . '_ReflectionClass'; |
| 92 | 92 | |
| 93 | 93 | // Prevent duplication |
| 94 | - if($this->h($sReflectionClass)) // It's important not to use the class name here. |
|
| 94 | + if ($this->h($sReflectionClass)) // It's important not to use the class name here. |
|
| 95 | 95 | { |
| 96 | 96 | return; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // Make sure the registered class exists |
| 100 | - if(isset($aOptions['include'])) |
|
| 100 | + if (isset($aOptions['include'])) |
|
| 101 | 101 | { |
| 102 | 102 | require_once($aOptions['include']); |
| 103 | 103 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $this->val($sReflectionClass, new ReflectionClass($sClassName)); |
| 108 | 108 | } |
| 109 | - catch(ReflectionException $e) |
|
| 109 | + catch (ReflectionException $e) |
|
| 110 | 110 | { |
| 111 | 111 | $xTranslator = $this->g(Translator::class); |
| 112 | 112 | $sMessage = $xTranslator->trans('errors.class.invalid', ['name' => $sClassName]); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | }); |
| 131 | 131 | |
| 132 | 132 | // Register the user class, but only if the user didn't already. |
| 133 | - if(!$this->h($sClassName)) |
|
| 133 | + if (!$this->h($sClassName)) |
|
| 134 | 134 | { |
| 135 | 135 | $this->set($sClassName, function($di) use($sReflectionClass) { |
| 136 | 136 | return $this->make($di->g($sReflectionClass)); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | // Initialize the user class instance |
| 140 | 140 | $this->xLibContainer->extend($sClassName, function($xRegisteredObject) |
| 141 | 141 | use($sCallableObject, $sClassName) { |
| 142 | - if($xRegisteredObject instanceof CallableClass) |
|
| 142 | + if ($xRegisteredObject instanceof CallableClass) |
|
| 143 | 143 | { |
| 144 | 144 | $cSetter = function($di) use($sClassName) { |
| 145 | 145 | // Set the protected attributes of the object |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $sPkgConfigKey = $this->getPackageConfigKey($sClassName); |
| 213 | 213 | $this->val($sPkgConfigKey, $xPkgConfig); |
| 214 | 214 | // Register the user class, but only if the user didn't already. |
| 215 | - if(!$this->h($sClassName)) |
|
| 215 | + if (!$this->h($sClassName)) |
|
| 216 | 216 | { |
| 217 | 217 | $this->set($sClassName, function() use($sClassName) { |
| 218 | 218 | return $this->make($sClassName); |
@@ -79,18 +79,18 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | private function makePhrase(array $aArgs): string |
| 81 | 81 | { |
| 82 | - if(empty($aArgs)) |
|
| 82 | + if (empty($aArgs)) |
|
| 83 | 83 | { |
| 84 | 84 | return ''; |
| 85 | 85 | } |
| 86 | 86 | // The first array entry is the message. |
| 87 | 87 | $sPhrase = array_shift($aArgs); |
| 88 | - if(empty($aArgs)) |
|
| 88 | + if (empty($aArgs)) |
|
| 89 | 89 | { |
| 90 | 90 | return $sPhrase; |
| 91 | 91 | } |
| 92 | 92 | $nParamId = 1; |
| 93 | - foreach($aArgs as &$xParameter) |
|
| 93 | + foreach ($aArgs as &$xParameter) |
|
| 94 | 94 | { |
| 95 | 95 | $xParameter = "'$nParamId':" . $xParameter->getScript(); |
| 96 | 96 | $nParamId++; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | private function makeMessage(): string |
| 107 | 107 | { |
| 108 | - if(!($sPhrase = $this->makePhrase($this->aMessageArgs))) |
|
| 108 | + if (!($sPhrase = $this->makePhrase($this->aMessageArgs))) |
|
| 109 | 109 | { |
| 110 | 110 | return ''; |
| 111 | 111 | } |
@@ -124,16 +124,15 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | $sMessageScript = $this->makeMessage(); |
| 126 | 126 | $sScript = parent::getScript(); |
| 127 | - if($this->bConfirm) |
|
| 127 | + if ($this->bConfirm) |
|
| 128 | 128 | { |
| 129 | 129 | $sConfirmPhrase = $this->makePhrase($this->aConfirmArgs); |
| 130 | 130 | $sScript = $this->xDialogLibraryManager->getQuestionLibrary() |
| 131 | 131 | ->confirm($sConfirmPhrase, $sScript, $sMessageScript); |
| 132 | 132 | } |
| 133 | - if($this->sCondition !== '') |
|
| 133 | + if ($this->sCondition !== '') |
|
| 134 | 134 | { |
| 135 | - $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' : |
|
| 136 | - 'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}'; |
|
| 135 | + $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' : 'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}'; |
|
| 137 | 136 | } |
| 138 | 137 | return $this->sVars . $sScript; |
| 139 | 138 | } |
@@ -145,9 +144,9 @@ discard block |
||
| 145 | 144 | */ |
| 146 | 145 | public function hasPageNumber(): bool |
| 147 | 146 | { |
| 148 | - foreach($this->aParameters as $xParameter) |
|
| 147 | + foreach ($this->aParameters as $xParameter) |
|
| 149 | 148 | { |
| 150 | - if($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
| 149 | + if ($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
| 151 | 150 | { |
| 152 | 151 | return true; |
| 153 | 152 | } |
@@ -165,9 +164,9 @@ discard block |
||
| 165 | 164 | public function setPageNumber(int $nPageNumber): Call |
| 166 | 165 | { |
| 167 | 166 | // Set the value of the Parameter::PAGE_NUMBER parameter |
| 168 | - foreach($this->aParameters as $xParameter) |
|
| 167 | + foreach ($this->aParameters as $xParameter) |
|
| 169 | 168 | { |
| 170 | - if($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
| 169 | + if ($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
| 171 | 170 | { |
| 172 | 171 | $xParameter->setValue($nPageNumber); |
| 173 | 172 | break; |
@@ -188,7 +187,7 @@ discard block |
||
| 188 | 187 | public function pg(int $nCurrentPage, int $nItemsPerPage, int $nItemsTotal): Paginator |
| 189 | 188 | { |
| 190 | 189 | // Append the page number to the parameter list, if not yet given. |
| 191 | - if(!$this->hasPageNumber()) |
|
| 190 | + if (!$this->hasPageNumber()) |
|
| 192 | 191 | { |
| 193 | 192 | $this->addParameter(Parameter::PAGE_NUMBER, 0); |
| 194 | 193 | } |
@@ -121,7 +121,7 @@ |
||
| 121 | 121 | */ |
| 122 | 122 | public function addParameters(array $aParameters): JsCall |
| 123 | 123 | { |
| 124 | - foreach($aParameters as $xParameter) |
|
| 124 | + foreach ($aParameters as $xParameter) |
|
| 125 | 125 | { |
| 126 | 126 | $this->pushParameter(Parameter::make($xParameter)); |
| 127 | 127 | } |