@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | try |
| 134 | 134 | {
|
| 135 | 135 | $xFilesystem->createDirectory($sUploadDir); |
| 136 | - if($xFilesystem->visibility($sUploadDir) !== Visibility::PUBLIC) |
|
| 136 | + if ($xFilesystem->visibility($sUploadDir) !== Visibility::PUBLIC) |
|
| 137 | 137 | {
|
| 138 | 138 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
| 139 | 139 | } |
| 140 | 140 | return $sUploadDir; |
| 141 | 141 | } |
| 142 | - catch(FilesystemException $e) |
|
| 142 | + catch (FilesystemException $e) |
|
| 143 | 143 | {
|
| 144 | 144 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 145 | 145 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | {
|
| 174 | 174 | // Check the uploaded file validity |
| 175 | 175 | $nErrorCode = $xHttpFile->getError(); |
| 176 | - if($nErrorCode !== UPLOAD_ERR_OK) |
|
| 176 | + if ($nErrorCode !== UPLOAD_ERR_OK) |
|
| 177 | 177 | {
|
| 178 | 178 | $this->xLogger->error('File upload error.', [
|
| 179 | 179 | 'code' => $nErrorCode, |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | // Filename without the extension. Needs to be sanitized. |
| 186 | 186 | $sName = pathinfo($xHttpFile->getClientFilename(), PATHINFO_FILENAME); |
| 187 | - if($this->cNameSanitizer !== null) |
|
| 187 | + if ($this->cNameSanitizer !== null) |
|
| 188 | 188 | {
|
| 189 | 189 | $sName = (string)call_user_func($this->cNameSanitizer, $sName, $sField, $this->sUploadFieldId); |
| 190 | 190 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | // Set the user file data |
| 193 | 193 | $xFile = File::fromHttpFile($this->xFileStorage->filesystem($sField), $xHttpFile, $sUploadDir, $sName); |
| 194 | 194 | // Verify file validity (format, size) |
| 195 | - if(!$this->xValidator->validateUploadedFile($sField, $xFile)) |
|
| 195 | + if (!$this->xValidator->validateUploadedFile($sField, $xFile)) |
|
| 196 | 196 | {
|
| 197 | 197 | throw new RequestException($this->xValidator->getErrorMessage()); |
| 198 | 198 | } |
@@ -217,16 +217,16 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | $aUserFiles = []; |
| 219 | 219 | $this->aAllFiles = []; // A flat list of all uploaded files |
| 220 | - foreach($aTempFiles as $sField => $aFiles) |
|
| 220 | + foreach ($aTempFiles as $sField => $aFiles) |
|
| 221 | 221 | {
|
| 222 | 222 | $aUserFiles[$sField] = []; |
| 223 | 223 | // Get the path to the upload dir |
| 224 | 224 | $sUploadDir = $this->getUploadDir($sField); |
| 225 | - if(!is_array($aFiles)) |
|
| 225 | + if (!is_array($aFiles)) |
|
| 226 | 226 | {
|
| 227 | 227 | $aFiles = [$aFiles]; |
| 228 | 228 | } |
| 229 | - foreach($aFiles as $xHttpFile) |
|
| 229 | + foreach ($aFiles as $xHttpFile) |
|
| 230 | 230 | {
|
| 231 | 231 | $aUserFiles[$sField][] = $this->makeUploadedFile($xHttpFile, $sUploadDir, $sField); |
| 232 | 232 | } |
@@ -234,12 +234,12 @@ discard block |
||
| 234 | 234 | // Copy the uploaded files from the temp dir to the user dir |
| 235 | 235 | try |
| 236 | 236 | {
|
| 237 | - foreach($this->aAllFiles as $aFiles) |
|
| 237 | + foreach ($this->aAllFiles as $aFiles) |
|
| 238 | 238 | {
|
| 239 | 239 | $aFiles['user']->filesystem()->write($aFiles['user']->path(), $aFiles['temp']->getStream()); |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | - catch(FilesystemException $e) |
|
| 242 | + catch (FilesystemException $e) |
|
| 243 | 243 | {
|
| 244 | 244 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 245 | 245 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
@@ -138,8 +138,7 @@ discard block |
||
| 138 | 138 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
| 139 | 139 | } |
| 140 | 140 | return $sUploadDir; |
| 141 | - } |
|
| 142 | - catch(FilesystemException $e) |
|
| 141 | + } catch(FilesystemException $e) |
|
| 143 | 142 | {
|
| 144 | 143 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 145 | 144 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
@@ -238,8 +237,7 @@ discard block |
||
| 238 | 237 | {
|
| 239 | 238 | $aFiles['user']->filesystem()->write($aFiles['user']->path(), $aFiles['temp']->getStream()); |
| 240 | 239 | } |
| 241 | - } |
|
| 242 | - catch(FilesystemException $e) |
|
| 240 | + } catch(FilesystemException $e) |
|
| 243 | 241 | {
|
| 244 | 242 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 245 | 243 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
@@ -19,24 +19,24 @@ |
||
| 19 | 19 | |
| 20 | 20 | interface LibraryRegistryInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * Get the AlertInterface library |
| 24 | 24 | * |
| 25 | 25 | * @return AlertInterface |
| 26 | 26 | */ |
| 27 | - public function getAlertLibrary(): AlertInterface; |
|
| 27 | +public function getAlertLibrary(): AlertInterface; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * Get the ConfirmInterface library |
| 31 | 31 | * |
| 32 | 32 | * @return ConfirmInterface |
| 33 | 33 | */ |
| 34 | - public function getConfirmLibrary(): ConfirmInterface; |
|
| 34 | +public function getConfirmLibrary(): ConfirmInterface; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * Get the ModalInterface library |
| 38 | 38 | * |
| 39 | 39 | * @return ModalInterface|null |
| 40 | 40 | */ |
| 41 | - public function getModalLibrary(): ?ModalInterface; |
|
| 41 | +public function getModalLibrary(): ?ModalInterface; |
|
| 42 | 42 | } |
@@ -16,45 +16,45 @@ |
||
| 16 | 16 | |
| 17 | 17 | interface LibraryInterface |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * Get the library name |
| 21 | 21 | * |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | - public function getName(): string; |
|
| 24 | +public function getName(): string; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * Get the library base URI |
| 28 | 28 | * |
| 29 | 29 | * @return string |
| 30 | 30 | */ |
| 31 | - public function getUri(): string; |
|
| 31 | +public function getUri(): string; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * Get the CSS header code and file includes |
| 35 | 35 | * |
| 36 | 36 | * @return string |
| 37 | 37 | */ |
| 38 | - public function getCss(): string; |
|
| 38 | +public function getCss(): string; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * Get the javascript header code and file includes |
| 42 | 42 | * |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - public function getJs(): string; |
|
| 45 | +public function getJs(): string; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * Get the javascript code to be printed into the page |
| 49 | 49 | * |
| 50 | 50 | * @return string |
| 51 | 51 | */ |
| 52 | - public function getScript(): string; |
|
| 52 | +public function getScript(): string; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 54 | +/** |
|
| 55 | 55 | * Get the javascript codes to include into the page |
| 56 | 56 | * |
| 57 | 57 | * @return JsCode|null |
| 58 | 58 | */ |
| 59 | - public function getJsCode(): ?JsCode; |
|
| 59 | +public function getJsCode(): ?JsCode; |
|
| 60 | 60 | } |
@@ -6,24 +6,24 @@ |
||
| 6 | 6 | |
| 7 | 7 | trait DialogTrait |
| 8 | 8 | {
|
| 9 | - /** |
|
| 9 | +/** |
|
| 10 | 10 | * @return AjaxResponse |
| 11 | 11 | */ |
| 12 | - abstract protected function response(): AjaxResponse; |
|
| 12 | +abstract protected function response(): AjaxResponse; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | +/** |
|
| 15 | 15 | * @return AlertInterface |
| 16 | 16 | */ |
| 17 | - protected function alert(): AlertInterface |
|
| 18 | - {
|
|
| 19 | - return $this->response()->dialog; |
|
| 20 | - } |
|
| 17 | +protected function alert(): AlertInterface |
|
| 18 | +{
|
|
| 19 | +return $this->response()->dialog; |
|
| 20 | +} |
|
| 21 | 21 | |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @return ModalInterface |
| 24 | 24 | */ |
| 25 | - protected function modal(): ModalInterface |
|
| 26 | - {
|
|
| 27 | - return $this->response()->dialog; |
|
| 28 | - } |
|
| 25 | +protected function modal(): ModalInterface |
|
| 26 | +{
|
|
| 27 | +return $this->response()->dialog; |
|
| 28 | +} |
|
| 29 | 29 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | interface ModalInterface |
| 18 | 18 | {
|
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * Show a modal dialog. |
| 21 | 21 | * |
| 22 | 22 | * @param string $sTitle The title of the dialog |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return void |
| 28 | 28 | */ |
| 29 | - public function show(string $sTitle, string $sContent, array $aButtons = [], array $aOptions = []): void; |
|
| 29 | +public function show(string $sTitle, string $sContent, array $aButtons = [], array $aOptions = []): void; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * Hide the modal dialog. |
| 33 | 33 | * |
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | - public function hide(): void; |
|
| 36 | +public function hide(): void; |
|
| 37 | 37 | } |
@@ -16,16 +16,16 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | interface AlertInterface |
| 18 | 18 | {
|
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * Set the title of the next message. |
| 21 | 21 | * |
| 22 | 22 | * @param string $sTitle The title of the message |
| 23 | 23 | * |
| 24 | 24 | * @return AlertInterface |
| 25 | 25 | */ |
| 26 | - public function title(string $sTitle): AlertInterface; |
|
| 26 | +public function title(string $sTitle): AlertInterface; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 28 | +/** |
|
| 29 | 29 | * Show a success message. |
| 30 | 30 | * |
| 31 | 31 | * @param string $sMessage The text of the message |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | - public function success(string $sMessage, ...$aArgs): void; |
|
| 36 | +public function success(string $sMessage, ...$aArgs): void; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * Show an information message. |
| 40 | 40 | * |
| 41 | 41 | * @param string $sMessage The text of the message |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return void |
| 45 | 45 | */ |
| 46 | - public function info(string $sMessage, ...$aArgs): void; |
|
| 46 | +public function info(string $sMessage, ...$aArgs): void; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * Show a warning message. |
| 50 | 50 | * |
| 51 | 51 | * @param string $sMessage The text of the message |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return void |
| 55 | 55 | */ |
| 56 | - public function warning(string $sMessage, ...$aArgs): void; |
|
| 56 | +public function warning(string $sMessage, ...$aArgs): void; |
|
| 57 | 57 | |
| 58 | - /** |
|
| 58 | +/** |
|
| 59 | 59 | * Show an error message. |
| 60 | 60 | * |
| 61 | 61 | * @param string $sMessage The text of the message |
@@ -63,5 +63,5 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function error(string $sMessage, ...$aArgs): void; |
|
| 66 | +public function error(string $sMessage, ...$aArgs): void; |
|
| 67 | 67 | } |
@@ -14,41 +14,41 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | trait ComponentTrait |
| 16 | 16 | { |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * Get the component helper |
| 19 | 19 | * |
| 20 | 20 | * @return ComponentHelper |
| 21 | 21 | */ |
| 22 | - abstract protected function helper(): ComponentHelper; |
|
| 22 | +abstract protected function helper(): ComponentHelper; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * Get the Ajax response |
| 26 | 26 | * |
| 27 | 27 | * @return AjaxResponse |
| 28 | 28 | */ |
| 29 | - abstract protected function response(): AjaxResponse; |
|
| 29 | +abstract protected function response(): AjaxResponse; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * Get the Jaxon request target |
| 33 | 33 | * |
| 34 | 34 | * @return TargetInterface|null |
| 35 | 35 | */ |
| 36 | - protected function target(): ?TargetInterface |
|
| 37 | - { |
|
| 38 | - return $this->helper()->xTarget; |
|
| 39 | - } |
|
| 36 | +protected function target(): ?TargetInterface |
|
| 37 | +{ |
|
| 38 | +return $this->helper()->xTarget; |
|
| 39 | +} |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | +/** |
|
| 42 | 42 | * Get the temp cache |
| 43 | 43 | * |
| 44 | 44 | * @return Stash |
| 45 | 45 | */ |
| 46 | - protected function stash(): Stash |
|
| 47 | - { |
|
| 48 | - return $this->helper()->xStash; |
|
| 49 | - } |
|
| 46 | +protected function stash(): Stash |
|
| 47 | +{ |
|
| 48 | +return $this->helper()->xStash; |
|
| 49 | +} |
|
| 50 | 50 | |
| 51 | - /** |
|
| 51 | +/** |
|
| 52 | 52 | * Get an instance of a Jaxon class by name |
| 53 | 53 | * |
| 54 | 54 | * @template T |
@@ -57,60 +57,60 @@ discard block |
||
| 57 | 57 | * @return T|null |
| 58 | 58 | * @throws SetupException |
| 59 | 59 | */ |
| 60 | - protected function cl(string $sClassName): mixed |
|
| 61 | - { |
|
| 62 | - return $this->helper()->cl($sClassName); |
|
| 63 | - } |
|
| 60 | +protected function cl(string $sClassName): mixed |
|
| 61 | +{ |
|
| 62 | +return $this->helper()->cl($sClassName); |
|
| 63 | +} |
|
| 64 | 64 | |
| 65 | - /** |
|
| 65 | +/** |
|
| 66 | 66 | * Get the logger |
| 67 | 67 | * |
| 68 | 68 | * @return LoggerInterface |
| 69 | 69 | */ |
| 70 | - protected function logger(): LoggerInterface |
|
| 71 | - { |
|
| 72 | - return $this->helper()->xLogger; |
|
| 73 | - } |
|
| 70 | +protected function logger(): LoggerInterface |
|
| 71 | +{ |
|
| 72 | +return $this->helper()->xLogger; |
|
| 73 | +} |
|
| 74 | 74 | |
| 75 | - /** |
|
| 75 | +/** |
|
| 76 | 76 | * Get the view renderer |
| 77 | 77 | * |
| 78 | 78 | * @return ViewRenderer |
| 79 | 79 | */ |
| 80 | - protected function view(): ViewRenderer |
|
| 81 | - { |
|
| 82 | - return $this->helper()->xViewRenderer; |
|
| 83 | - } |
|
| 80 | +protected function view(): ViewRenderer |
|
| 81 | +{ |
|
| 82 | +return $this->helper()->xViewRenderer; |
|
| 83 | +} |
|
| 84 | 84 | |
| 85 | - /** |
|
| 85 | +/** |
|
| 86 | 86 | * Get the session manager |
| 87 | 87 | * |
| 88 | 88 | * @return SessionInterface |
| 89 | 89 | */ |
| 90 | - protected function session(): SessionInterface |
|
| 91 | - { |
|
| 92 | - return $this->helper()->xSessionManager; |
|
| 93 | - } |
|
| 90 | +protected function session(): SessionInterface |
|
| 91 | +{ |
|
| 92 | +return $this->helper()->xSessionManager; |
|
| 93 | +} |
|
| 94 | 94 | |
| 95 | - /** |
|
| 95 | +/** |
|
| 96 | 96 | * Get the uploaded files |
| 97 | 97 | * |
| 98 | 98 | * @return array |
| 99 | 99 | */ |
| 100 | - protected function files(): array |
|
| 101 | - { |
|
| 102 | - return $this->helper()->xUploadHandler->files(); |
|
| 103 | - } |
|
| 100 | +protected function files(): array |
|
| 101 | +{ |
|
| 102 | +return $this->helper()->xUploadHandler->files(); |
|
| 103 | +} |
|
| 104 | 104 | |
| 105 | - /** |
|
| 105 | +/** |
|
| 106 | 106 | * Get a data bag. |
| 107 | 107 | * |
| 108 | 108 | * @param string $sBagName |
| 109 | 109 | * |
| 110 | 110 | * @return DataBagContext |
| 111 | 111 | */ |
| 112 | - protected function bag(string $sBagName): DataBagContext |
|
| 113 | - { |
|
| 114 | - return $this->response()->bag($sBagName); |
|
| 115 | - } |
|
| 112 | +protected function bag(string $sBagName): DataBagContext |
|
| 113 | +{ |
|
| 114 | +return $this->response()->bag($sBagName); |
|
| 115 | +} |
|
| 116 | 116 | } |
@@ -8,19 +8,19 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class Pagination extends AbstractComponent |
| 10 | 10 | { |
| 11 | - use HelperTrait; |
|
| 12 | - use NodeResponseTrait; |
|
| 11 | +use HelperTrait; |
|
| 12 | +use NodeResponseTrait; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | +/** |
|
| 15 | 15 | * @inheritDoc |
| 16 | 16 | */ |
| 17 | - protected function initComponent(Container $di, ComponentHelper $xHelper): void |
|
| 18 | - { |
|
| 19 | - $this->setHelper($xHelper); |
|
| 20 | - $this->setNodeResponse($di); |
|
| 21 | - } |
|
| 17 | +protected function initComponent(Container $di, ComponentHelper $xHelper): void |
|
| 18 | +{ |
|
| 19 | +$this->setHelper($xHelper); |
|
| 20 | +$this->setNodeResponse($di); |
|
| 21 | +} |
|
| 22 | 22 | |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * Create a paginator. |
| 25 | 25 | * |
| 26 | 26 | * @param int $nPageNumber The current page number |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return Paginator |
| 31 | 31 | */ |
| 32 | - final public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator |
|
| 33 | - { |
|
| 34 | - return $this->nodeResponse->paginator($nPageNumber, $nItemsPerPage, $nTotalItems); |
|
| 35 | - } |
|
| 32 | +final public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator |
|
| 33 | +{ |
|
| 34 | +return $this->nodeResponse->paginator($nPageNumber, $nItemsPerPage, $nTotalItems); |
|
| 35 | +} |
|
| 36 | 36 | } |
@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | abstract class AbstractComponent |
| 10 | 10 | { |
| 11 | - /** |
|
| 11 | +/** |
|
| 12 | 12 | * Get the component helper |
| 13 | 13 | * |
| 14 | 14 | * @return ComponentHelper |
| 15 | 15 | */ |
| 16 | - abstract protected function helper(): ComponentHelper; |
|
| 16 | +abstract protected function helper(): ComponentHelper; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 18 | +/** |
|
| 19 | 19 | * Initialize the component |
| 20 | 20 | * |
| 21 | 21 | * @param Container $di |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return void |
| 25 | 25 | */ |
| 26 | - abstract protected function initComponent(Container $di, ComponentHelper $xHelper); |
|
| 26 | +abstract protected function initComponent(Container $di, ComponentHelper $xHelper); |
|
| 27 | 27 | |
| 28 | - /** |
|
| 28 | +/** |
|
| 29 | 29 | * Get the js call factory. |
| 30 | 30 | * |
| 31 | 31 | * @param string $sClassName |
| 32 | 32 | * |
| 33 | 33 | * @return JxnCall |
| 34 | 34 | */ |
| 35 | - protected function rq(string $sClassName = ''): JxnCall |
|
| 36 | - { |
|
| 37 | - return $this->helper()->rq($sClassName); |
|
| 38 | - } |
|
| 35 | +protected function rq(string $sClassName = ''): JxnCall |
|
| 36 | +{ |
|
| 37 | +return $this->helper()->rq($sClassName); |
|
| 38 | +} |
|
| 39 | 39 | } |