@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | public static function parseAnnotation($value) |
| 42 | 42 | { |
| 43 | 43 | $aParams = preg_split('/[\s]+/', $value, 2); |
| 44 | - return count($aParams) === 1 ? ['field' => $aParams[0]] : |
|
| 45 | - ['field' => $aParams[0], 'extra' => $aParams[1]]; |
|
| 44 | + return count($aParams) === 1 ? ['field' => $aParams[0]] : ['field' => $aParams[0], 'extra' => $aParams[1]]; |
|
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | /** |
@@ -51,7 +50,7 @@ discard block |
||
| 51 | 50 | */ |
| 52 | 51 | public function initAnnotation(array $properties) |
| 53 | 52 | { |
| 54 | - if(count($properties) != 1 || !isset($properties['field']) || |
|
| 53 | + if (count($properties) != 1 || !isset($properties['field']) || |
|
| 55 | 54 | !is_string($properties['field'])) |
| 56 | 55 | { |
| 57 | 56 | throw new AnnotationException('The @upload annotation requires a property "field" of type string'); |
@@ -27,64 +27,64 @@ |
||
| 27 | 27 | |
| 28 | 28 | abstract class HookAnnotation extends AbstractAnnotation |
| 29 | 29 | { |
| 30 | - /** |
|
| 30 | +/** |
|
| 31 | 31 | * @var string |
| 32 | 32 | */ |
| 33 | - protected $sMethod = ''; |
|
| 33 | +protected $sMethod = ''; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 35 | +/** |
|
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | - protected $aParams = []; |
|
| 38 | +protected $aParams = []; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * |
| 42 | 42 | */ |
| 43 | - abstract protected static function getType(): string; |
|
| 43 | +abstract protected static function getType(): string; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | +/** |
|
| 46 | 46 | * @inheritDoc |
| 47 | 47 | */ |
| 48 | - public static function parseAnnotation($value) |
|
| 49 | - { |
|
| 50 | - $aParams = preg_split('/[\s]+/', $value, 2); |
|
| 51 | - if(count($aParams) === 1) |
|
| 52 | - { |
|
| 53 | - return ['call' => rtrim($aParams[0])]; |
|
| 54 | - } |
|
| 55 | - // The second parameter must be an array of callback parameter in json format. |
|
| 56 | - return ['call' => rtrim($aParams[0]), 'with' => json_decode($aParams[1], false)]; |
|
| 57 | - } |
|
| 48 | +public static function parseAnnotation($value) |
|
| 49 | +{ |
|
| 50 | +$aParams = preg_split('/[\s]+/', $value, 2); |
|
| 51 | +if(count($aParams) === 1) |
|
| 52 | +{ |
|
| 53 | +return ['call' => rtrim($aParams[0])]; |
|
| 54 | +} |
|
| 55 | +// The second parameter must be an array of callback parameter in json format. |
|
| 56 | +return ['call' => rtrim($aParams[0]), 'with' => json_decode($aParams[1], false)]; |
|
| 57 | +} |
|
| 58 | 58 | |
| 59 | - /** |
|
| 59 | +/** |
|
| 60 | 60 | * @inheritDoc |
| 61 | 61 | * @throws AnnotationException |
| 62 | 62 | */ |
| 63 | - public function initAnnotation(array $properties) |
|
| 64 | - { |
|
| 65 | - if(!isset($properties['call']) || !is_string($properties['call'])) |
|
| 66 | - { |
|
| 67 | - throw new AnnotationException('The @' . $this->getType() . |
|
| 68 | - ' annotation requires a property "call" of type string'); |
|
| 69 | - } |
|
| 70 | - foreach(array_keys($properties) as $propName) |
|
| 71 | - { |
|
| 72 | - if($propName !== 'call' && $propName !== 'with') |
|
| 73 | - { |
|
| 74 | - throw new AnnotationException('Unknown property "' . $propName . |
|
| 75 | - '" in the @' . $this->getType() . ' annotation'); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - // Cannot use isset here, because it will return false in case $properties['with'] === null |
|
| 79 | - if(array_key_exists('with', $properties)) |
|
| 80 | - { |
|
| 81 | - if(!is_array($properties['with'])) |
|
| 82 | - { |
|
| 83 | - throw new AnnotationException('The "with" property of the @' . |
|
| 84 | - $this->getType() . ' annotation must be of type array'); |
|
| 85 | - } |
|
| 86 | - $this->aParams = $properties['with']; |
|
| 87 | - } |
|
| 88 | - $this->sMethod = $properties['call']; |
|
| 89 | - } |
|
| 63 | +public function initAnnotation(array $properties) |
|
| 64 | +{ |
|
| 65 | +if(!isset($properties['call']) || !is_string($properties['call'])) |
|
| 66 | +{ |
|
| 67 | +throw new AnnotationException('The @' . $this->getType() . |
|
| 68 | + ' annotation requires a property "call" of type string'); |
|
| 69 | +} |
|
| 70 | +foreach(array_keys($properties) as $propName) |
|
| 71 | +{ |
|
| 72 | +if($propName !== 'call' && $propName !== 'with') |
|
| 73 | +{ |
|
| 74 | + throw new AnnotationException('Unknown property "' . $propName . |
|
| 75 | + '" in the @' . $this->getType() . ' annotation'); |
|
| 76 | +} |
|
| 77 | +} |
|
| 78 | +// Cannot use isset here, because it will return false in case $properties['with'] === null |
|
| 79 | +if(array_key_exists('with', $properties)) |
|
| 80 | +{ |
|
| 81 | +if(!is_array($properties['with'])) |
|
| 82 | +{ |
|
| 83 | + throw new AnnotationException('The "with" property of the @' . |
|
| 84 | + $this->getType() . ' annotation must be of type array'); |
|
| 85 | +} |
|
| 86 | +$this->aParams = $properties['with']; |
|
| 87 | +} |
|
| 88 | +$this->sMethod = $properties['call']; |
|
| 89 | +} |
|
| 90 | 90 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public static function parseAnnotation($value) |
| 49 | 49 | { |
| 50 | 50 | $aParams = preg_split('/[\s]+/', $value, 2); |
| 51 | - if(count($aParams) === 1) |
|
| 51 | + if (count($aParams) === 1) |
|
| 52 | 52 | { |
| 53 | 53 | return ['call' => rtrim($aParams[0])]; |
| 54 | 54 | } |
@@ -62,23 +62,23 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function initAnnotation(array $properties) |
| 64 | 64 | { |
| 65 | - if(!isset($properties['call']) || !is_string($properties['call'])) |
|
| 65 | + if (!isset($properties['call']) || !is_string($properties['call'])) |
|
| 66 | 66 | { |
| 67 | 67 | throw new AnnotationException('The @' . $this->getType() . |
| 68 | 68 | ' annotation requires a property "call" of type string'); |
| 69 | 69 | } |
| 70 | - foreach(array_keys($properties) as $propName) |
|
| 70 | + foreach (array_keys($properties) as $propName) |
|
| 71 | 71 | { |
| 72 | - if($propName !== 'call' && $propName !== 'with') |
|
| 72 | + if ($propName !== 'call' && $propName !== 'with') |
|
| 73 | 73 | { |
| 74 | 74 | throw new AnnotationException('Unknown property "' . $propName . |
| 75 | 75 | '" in the @' . $this->getType() . ' annotation'); |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | // Cannot use isset here, because it will return false in case $properties['with'] === null |
| 79 | - if(array_key_exists('with', $properties)) |
|
| 79 | + if (array_key_exists('with', $properties)) |
|
| 80 | 80 | { |
| 81 | - if(!is_array($properties['with'])) |
|
| 81 | + if (!is_array($properties['with'])) |
|
| 82 | 82 | { |
| 83 | 83 | throw new AnnotationException('The "with" property of the @' . |
| 84 | 84 | $this->getType() . ' annotation must be of type array'); |
@@ -114,21 +114,21 @@ discard block |
||
| 114 | 114 | fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class) |
| 115 | 115 | ); |
| 116 | 116 | // First check if the class is excluded. |
| 117 | - foreach($aAnnotations as $xAnnotation) |
|
| 117 | + foreach ($aAnnotations as $xAnnotation) |
|
| 118 | 118 | { |
| 119 | - if(is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 119 | + if (is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 120 | 120 | { |
| 121 | 121 | $xAnnotation->saveValue($this->xMetadata); |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | - if($this->xMetadata->isExcluded()) |
|
| 124 | + if ($this->xMetadata->isExcluded()) |
|
| 125 | 125 | { |
| 126 | 126 | return; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - foreach($aAnnotations as $xAnnotation) |
|
| 129 | + foreach ($aAnnotations as $xAnnotation) |
|
| 130 | 130 | { |
| 131 | - if(!is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 131 | + if (!is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 132 | 132 | { |
| 133 | 133 | $xAnnotation->saveValue($this->xMetadata); |
| 134 | 134 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $this->xManager->getPropertyAnnotations($sClass, $sProperty), |
| 151 | 151 | function($xAnnotation) use($sProperty) { |
| 152 | 152 | // Save the property type |
| 153 | - if(is_a($xAnnotation, VarAnnotation::class)) |
|
| 153 | + if (is_a($xAnnotation, VarAnnotation::class)) |
|
| 154 | 154 | { |
| 155 | 155 | $this->aPropTypes[$sProperty] = $xAnnotation->type; |
| 156 | 156 | } |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | return is_a($xAnnotation, ContainerAnnotation::class); |
| 159 | 159 | } |
| 160 | 160 | ); |
| 161 | - if(count($aAnnotations) > 1) |
|
| 161 | + if (count($aAnnotations) > 1) |
|
| 162 | 162 | { |
| 163 | 163 | throw new AnnotationException('Only one @di annotation is allowed on a property'); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - foreach($aAnnotations as $xAnnotation) |
|
| 166 | + foreach ($aAnnotations as $xAnnotation) |
|
| 167 | 167 | { |
| 168 | 168 | $xAnnotation->setAttr($sProperty); |
| 169 | 169 | $xAnnotation->saveValue($this->xMetadata); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $this->xManager->getMethodAnnotations($sClass, $sMethod), |
| 186 | 186 | fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class) |
| 187 | 187 | ); |
| 188 | - foreach($aAnnotations as $xAnnotation) |
|
| 188 | + foreach ($aAnnotations as $xAnnotation) |
|
| 189 | 189 | { |
| 190 | 190 | $xAnnotation->saveValue($this->xMetadata, $sMethod); |
| 191 | 191 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $this->sCurrMemberType = AnnotationManager::MEMBER_CLASS; |
| 209 | 209 | |
| 210 | 210 | $this->getClassAttrs($sClass); |
| 211 | - if($this->xMetadata->isExcluded()) |
|
| 211 | + if ($this->xMetadata->isExcluded()) |
|
| 212 | 212 | { |
| 213 | 213 | // The entire class is not to be exported. |
| 214 | 214 | return $this->xMetadata; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $this->sCurrMemberType = AnnotationManager::MEMBER_PROPERTY; |
| 219 | 219 | |
| 220 | 220 | // Properties annotations |
| 221 | - foreach($xInput->getProperties() as $sProperty) |
|
| 221 | + foreach ($xInput->getProperties() as $sProperty) |
|
| 222 | 222 | { |
| 223 | 223 | $this->getPropertyAttrs($sClass, $sProperty); |
| 224 | 224 | } |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | // Processing methods annotations |
| 227 | 227 | $this->sCurrMemberType = AnnotationManager::MEMBER_METHOD; |
| 228 | 228 | |
| 229 | - foreach($xInput->getMethods() as $sMethod) |
|
| 229 | + foreach ($xInput->getMethods() as $sMethod) |
|
| 230 | 230 | { |
| 231 | 231 | $this->getMethodAttrs($sClass, $sMethod); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | return $this->xMetadata; |
| 235 | 235 | } |
| 236 | - catch(AnnotationException $e) |
|
| 236 | + catch (AnnotationException $e) |
|
| 237 | 237 | { |
| 238 | 238 | throw new SetupException($e->getMessage()); |
| 239 | 239 | } |
@@ -232,8 +232,7 @@ |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | return $this->xMetadata; |
| 235 | - } |
|
| 236 | - catch(AnnotationException $e) |
|
| 235 | + } catch(AnnotationException $e) |
|
| 237 | 236 | { |
| 238 | 237 | throw new SetupException($e->getMessage()); |
| 239 | 238 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $jaxon = jaxon(); |
| 26 | 26 | $di = $jaxon->di(); |
| 27 | - if($di->h(UploadHandler::class)) |
|
| 27 | + if ($di->h(UploadHandler::class)) |
|
| 28 | 28 | { |
| 29 | 29 | return; |
| 30 | 30 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $xUploadHandler = $di->g(UploadHandler::class); |
| 77 | 77 | // The HTTP request |
| 78 | 78 | $xRequest = $di->getRequest(); |
| 79 | - if($xUploadHandler->canProcessRequest($xRequest)) |
|
| 79 | + if ($xUploadHandler->canProcessRequest($xRequest)) |
|
| 80 | 80 | { |
| 81 | 81 | $xUploadHandler->processRequest($xRequest); |
| 82 | 82 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $jaxon = jaxon(); |
| 94 | 94 | $jaxon->callback()->boot(function() use($jaxon) { |
| 95 | - if($jaxon->getOption('core.upload.enabled')) |
|
| 95 | + if ($jaxon->getOption('core.upload.enabled')) |
|
| 96 | 96 | { |
| 97 | 97 | registerUpload(); |
| 98 | 98 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | function register() |
| 103 | 103 | { |
| 104 | 104 | // Do nothing if running in cli. |
| 105 | - if(php_sapi_name() !== 'cli') |
|
| 105 | + if (php_sapi_name() !== 'cli') |
|
| 106 | 106 | { |
| 107 | 107 | _register(); |
| 108 | 108 | }; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | {
|
| 98 | 98 | $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty);
|
| 99 | 99 | $aAllowed = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
|
| 100 | - if(is_array($aAllowed) && !in_array($sValue, $aAllowed)) |
|
| 100 | + if (is_array($aAllowed) && !in_array($sValue, $aAllowed)) |
|
| 101 | 101 | {
|
| 102 | 102 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sField, [$sField => $sValue]);
|
| 103 | 103 | return false; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | {
|
| 119 | 119 | $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty, 0);
|
| 120 | 120 | $nSize = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
|
| 121 | - if($nSize > 0 && ( |
|
| 121 | + if ($nSize > 0 && ( |
|
| 122 | 122 | ($sProperty == 'max-size' && $nFileSize > $nSize) || |
| 123 | 123 | ($sProperty == 'min-size' && $nFileSize < $nSize))) |
| 124 | 124 | {
|
@@ -140,25 +140,25 @@ discard block |
||
| 140 | 140 | {
|
| 141 | 141 | $this->sErrorMessage = ''; |
| 142 | 142 | // Verify the file extension |
| 143 | - if(!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type')) |
|
| 143 | + if (!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type')) |
|
| 144 | 144 | {
|
| 145 | 145 | return false; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Verify the file extension |
| 149 | - if(!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension')) |
|
| 149 | + if (!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension')) |
|
| 150 | 150 | {
|
| 151 | 151 | return false; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Verify the max size |
| 155 | - if(!$this->validateFileSize($sVarName, $xFile->size(), 'max-size')) |
|
| 155 | + if (!$this->validateFileSize($sVarName, $xFile->size(), 'max-size')) |
|
| 156 | 156 | {
|
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Verify the min size |
| 161 | - if(!$this->validateFileSize($sVarName, $xFile->size(), 'min-size')) |
|
| 161 | + if (!$this->validateFileSize($sVarName, $xFile->size(), 'min-size')) |
|
| 162 | 162 | {
|
| 163 | 163 | return false; |
| 164 | 164 | } |
@@ -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'));
|
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | try |
| 134 | 134 | {
|
| 135 | 135 | $xFilesystem->createDirectory($sUploadDir); |
| 136 | - if(!$xFilesystem->directoryExists($sUploadDir)) |
|
| 136 | + if (!$xFilesystem->directoryExists($sUploadDir)) |
|
| 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'));
|
@@ -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 | } |