@@ -22,61 +22,61 @@ |
||
| 22 | 22 | |
| 23 | 23 | class DatabagData extends AbstractData |
| 24 | 24 | { |
| 25 | - /** |
|
| 25 | +/** |
|
| 26 | 26 | * The databag names |
| 27 | 27 | * |
| 28 | 28 | * @var array |
| 29 | 29 | */ |
| 30 | - protected $aNames = []; |
|
| 30 | +protected $aNames = []; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | +/** |
|
| 33 | 33 | * @return string |
| 34 | 34 | */ |
| 35 | - public function getName(): string |
|
| 36 | - { |
|
| 37 | - return 'bags'; |
|
| 38 | - } |
|
| 35 | +public function getName(): string |
|
| 36 | +{ |
|
| 37 | +return 'bags'; |
|
| 38 | +} |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public function getValue(): mixed |
|
| 44 | - { |
|
| 45 | - return array_values($this->aNames); |
|
| 46 | - } |
|
| 43 | +public function getValue(): mixed |
|
| 44 | +{ |
|
| 45 | +return array_values($this->aNames); |
|
| 46 | +} |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * @param string $sName |
| 50 | 50 | * |
| 51 | 51 | * @return void |
| 52 | 52 | */ |
| 53 | - protected function validateName(string $sName): void |
|
| 54 | - { |
|
| 55 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 56 | - { |
|
| 57 | - return; |
|
| 58 | - } |
|
| 59 | - throw new SetupException("$sName is not a valid \"name\" value for databag"); |
|
| 60 | - } |
|
| 53 | +protected function validateName(string $sName): void |
|
| 54 | +{ |
|
| 55 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 56 | +{ |
|
| 57 | +return; |
|
| 58 | +} |
|
| 59 | +throw new SetupException("$sName is not a valid \"name\" value for databag"); |
|
| 60 | +} |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * @param string $sName |
| 64 | 64 | * |
| 65 | 65 | * @return void |
| 66 | 66 | */ |
| 67 | - public function addValue(string $sName): void |
|
| 68 | - { |
|
| 69 | - $this->validateName($sName); |
|
| 67 | +public function addValue(string $sName): void |
|
| 68 | +{ |
|
| 69 | +$this->validateName($sName); |
|
| 70 | 70 | |
| 71 | - $this->aNames[$sName] = $sName; |
|
| 72 | - } |
|
| 71 | +$this->aNames[$sName] = $sName; |
|
| 72 | +} |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | +/** |
|
| 75 | 75 | * @inheritDoc |
| 76 | 76 | */ |
| 77 | - public function encode(string $sVarName): array |
|
| 78 | - { |
|
| 79 | - return array_map(fn($sName) => |
|
| 80 | - "{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 81 | - } |
|
| 77 | +public function encode(string $sVarName): array |
|
| 78 | +{ |
|
| 79 | +return array_map(fn($sName) => |
|
| 80 | +"{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 81 | +} |
|
| 82 | 82 | } |
@@ -22,61 +22,61 @@ |
||
| 22 | 22 | |
| 23 | 23 | class CallbackData extends AbstractData |
| 24 | 24 | { |
| 25 | - /** |
|
| 25 | +/** |
|
| 26 | 26 | * The callback js objects |
| 27 | 27 | * |
| 28 | 28 | * @var array |
| 29 | 29 | */ |
| 30 | - protected $aNames = []; |
|
| 30 | +protected $aNames = []; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | +/** |
|
| 33 | 33 | * @return string |
| 34 | 34 | */ |
| 35 | - public function getName(): string |
|
| 36 | - { |
|
| 37 | - return 'callback'; |
|
| 38 | - } |
|
| 35 | +public function getName(): string |
|
| 36 | +{ |
|
| 37 | +return 'callback'; |
|
| 38 | +} |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public function getValue(): mixed |
|
| 44 | - { |
|
| 45 | - return array_values($this->aNames); |
|
| 46 | - } |
|
| 43 | +public function getValue(): mixed |
|
| 44 | +{ |
|
| 45 | +return array_values($this->aNames); |
|
| 46 | +} |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * @param string $sName |
| 50 | 50 | * |
| 51 | 51 | * @return void |
| 52 | 52 | */ |
| 53 | - protected function validateObjectName(string $sName): void |
|
| 54 | - { |
|
| 55 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 56 | - { |
|
| 57 | - return; |
|
| 58 | - } |
|
| 59 | - throw new SetupException("$sName is not a valid \"name\" value for callback"); |
|
| 60 | - } |
|
| 53 | +protected function validateObjectName(string $sName): void |
|
| 54 | +{ |
|
| 55 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 56 | +{ |
|
| 57 | +return; |
|
| 58 | +} |
|
| 59 | +throw new SetupException("$sName is not a valid \"name\" value for callback"); |
|
| 60 | +} |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * @param string $sName |
| 64 | 64 | * |
| 65 | 65 | * @return void |
| 66 | 66 | */ |
| 67 | - public function addValue(string $sName): void |
|
| 68 | - { |
|
| 69 | - $this->validateObjectName($sName); |
|
| 67 | +public function addValue(string $sName): void |
|
| 68 | +{ |
|
| 69 | +$this->validateObjectName($sName); |
|
| 70 | 70 | |
| 71 | - $this->aNames[$sName] = $sName; |
|
| 72 | - } |
|
| 71 | +$this->aNames[$sName] = $sName; |
|
| 72 | +} |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | +/** |
|
| 75 | 75 | * @inheritDoc |
| 76 | 76 | */ |
| 77 | - public function encode(string $sVarName): array |
|
| 78 | - { |
|
| 79 | - return array_map(fn($sName) => |
|
| 80 | - "{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 81 | - } |
|
| 77 | +public function encode(string $sVarName): array |
|
| 78 | +{ |
|
| 79 | +return array_map(fn($sName) => |
|
| 80 | +"{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 81 | +} |
|
| 82 | 82 | } |
@@ -21,81 +21,81 @@ |
||
| 21 | 21 | |
| 22 | 22 | class ContainerData extends AbstractData |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * The properties to get from the container |
| 26 | 26 | * |
| 27 | 27 | * @var array |
| 28 | 28 | */ |
| 29 | - protected $aProperties = []; |
|
| 29 | +protected $aProperties = []; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | - public function getName(): string |
|
| 35 | - { |
|
| 36 | - return '__di'; |
|
| 37 | - } |
|
| 34 | +public function getName(): string |
|
| 35 | +{ |
|
| 36 | +return '__di'; |
|
| 37 | +} |
|
| 38 | 38 | |
| 39 | - /** |
|
| 39 | +/** |
|
| 40 | 40 | * @return mixed |
| 41 | 41 | */ |
| 42 | - public function getValue(): mixed |
|
| 43 | - { |
|
| 44 | - return $this->aProperties; |
|
| 45 | - } |
|
| 42 | +public function getValue(): mixed |
|
| 43 | +{ |
|
| 44 | +return $this->aProperties; |
|
| 45 | +} |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * @param string $sAttr |
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - protected function validateAttr(string $sAttr): void |
|
| 53 | - { |
|
| 54 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0) |
|
| 55 | - { |
|
| 56 | - return; |
|
| 57 | - } |
|
| 58 | - throw new SetupException("$sAttr is not a valid \"attr\" value for di"); |
|
| 59 | - } |
|
| 52 | +protected function validateAttr(string $sAttr): void |
|
| 53 | +{ |
|
| 54 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0) |
|
| 55 | +{ |
|
| 56 | +return; |
|
| 57 | +} |
|
| 58 | +throw new SetupException("$sAttr is not a valid \"attr\" value for di"); |
|
| 59 | +} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * @param string $sClass |
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - protected function validateClass(string $sClass): void |
|
| 67 | - { |
|
| 68 | - if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0) |
|
| 69 | - { |
|
| 70 | - return; |
|
| 71 | - } |
|
| 72 | - throw new SetupException("$sClass is not a valid \"class\" value for di"); |
|
| 73 | - } |
|
| 66 | +protected function validateClass(string $sClass): void |
|
| 67 | +{ |
|
| 68 | +if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0) |
|
| 69 | +{ |
|
| 70 | +return; |
|
| 71 | +} |
|
| 72 | +throw new SetupException("$sClass is not a valid \"class\" value for di"); |
|
| 73 | +} |
|
| 74 | 74 | |
| 75 | - /** |
|
| 75 | +/** |
|
| 76 | 76 | * @param string $sAttr |
| 77 | 77 | * @param string $sClass |
| 78 | 78 | * |
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | - public function addValue(string $sAttr, string $sClass): void |
|
| 82 | - { |
|
| 83 | - $this->validateAttr($sAttr); |
|
| 84 | - $this->validateClass($sClass); |
|
| 81 | +public function addValue(string $sAttr, string $sClass): void |
|
| 82 | +{ |
|
| 83 | +$this->validateAttr($sAttr); |
|
| 84 | +$this->validateClass($sClass); |
|
| 85 | 85 | |
| 86 | - $this->aProperties[$sAttr] = $sClass; |
|
| 87 | - } |
|
| 86 | +$this->aProperties[$sAttr] = $sClass; |
|
| 87 | +} |
|
| 88 | 88 | |
| 89 | - /** |
|
| 89 | +/** |
|
| 90 | 90 | * @inheritDoc |
| 91 | 91 | */ |
| 92 | - public function encode(string $sVarName): array |
|
| 93 | - { |
|
| 94 | - $aCalls = []; |
|
| 95 | - foreach($this->aProperties as $sAttr => $sClass) |
|
| 96 | - { |
|
| 97 | - $aCalls[] = "{$sVarName}->addValue('$sAttr', '" . addslashes($sClass) . "');"; |
|
| 98 | - } |
|
| 99 | - return $aCalls; |
|
| 100 | - } |
|
| 92 | +public function encode(string $sVarName): array |
|
| 93 | +{ |
|
| 94 | +$aCalls = []; |
|
| 95 | +foreach($this->aProperties as $sAttr => $sClass) |
|
| 96 | +{ |
|
| 97 | +$aCalls[] = "{$sVarName}->addValue('$sAttr', '" . addslashes($sClass) . "');"; |
|
| 98 | +} |
|
| 99 | +return $aCalls; |
|
| 100 | +} |
|
| 101 | 101 | } |
@@ -18,32 +18,32 @@ |
||
| 18 | 18 | |
| 19 | 19 | abstract class AbstractData |
| 20 | 20 | { |
| 21 | - /** |
|
| 21 | +/** |
|
| 22 | 22 | * Generate the PHP code to populate a Metadata object |
| 23 | 23 | * |
| 24 | 24 | * @param string $sVarName |
| 25 | 25 | * |
| 26 | 26 | * @return array |
| 27 | 27 | */ |
| 28 | - abstract public function encode(string $sVarName): array; |
|
| 28 | +abstract public function encode(string $sVarName): array; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 30 | +/** |
|
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - abstract public function getName(): string; |
|
| 33 | +abstract public function getName(): string; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 35 | +/** |
|
| 36 | 36 | * @return mixed |
| 37 | 37 | */ |
| 38 | - abstract public function getValue(): mixed; |
|
| 38 | +abstract public function getValue(): mixed; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * @param string $sMethod |
| 42 | 42 | * |
| 43 | 43 | * @return bool |
| 44 | 44 | */ |
| 45 | - protected function validateMethod(string $sMethod): bool |
|
| 46 | - { |
|
| 47 | - return preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0; |
|
| 48 | - } |
|
| 45 | +protected function validateMethod(string $sMethod): bool |
|
| 46 | +{ |
|
| 47 | +return preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0; |
|
| 48 | +} |
|
| 49 | 49 | } |
@@ -45,49 +45,49 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | class PluginManager |
| 47 | 47 | { |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * Request plugins, indexed by name |
| 50 | 50 | * |
| 51 | 51 | * @var array<string> |
| 52 | 52 | */ |
| 53 | - private $aRegistryPlugins = []; |
|
| 53 | +private $aRegistryPlugins = []; |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | +/** |
|
| 56 | 56 | * Request handlers, indexed by name |
| 57 | 57 | * |
| 58 | 58 | * @var array<string> |
| 59 | 59 | */ |
| 60 | - private $aRequestHandlers = []; |
|
| 60 | +private $aRequestHandlers = []; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * Response plugins, indexed by name |
| 64 | 64 | * |
| 65 | 65 | * @var array<string> |
| 66 | 66 | */ |
| 67 | - private $aResponsePlugins = []; |
|
| 67 | +private $aResponsePlugins = []; |
|
| 68 | 68 | |
| 69 | - /** |
|
| 69 | +/** |
|
| 70 | 70 | * The constructor |
| 71 | 71 | * |
| 72 | 72 | * @param Container $di |
| 73 | 73 | * @param CodeGenerator $xCodeGenerator |
| 74 | 74 | * @param Translator $xTranslator |
| 75 | 75 | */ |
| 76 | - public function __construct(private Container $di, |
|
| 77 | - private CodeGenerator $xCodeGenerator, private Translator $xTranslator) |
|
| 78 | - {} |
|
| 76 | +public function __construct(private Container $di, |
|
| 77 | +private CodeGenerator $xCodeGenerator, private Translator $xTranslator) |
|
| 78 | +{} |
|
| 79 | 79 | |
| 80 | - /** |
|
| 80 | +/** |
|
| 81 | 81 | * Get the request plugins |
| 82 | 82 | * |
| 83 | 83 | * @return array<class-string> |
| 84 | 84 | */ |
| 85 | - public function getRequestHandlers(): array |
|
| 86 | - { |
|
| 87 | - return $this->aRequestHandlers; |
|
| 88 | - } |
|
| 85 | +public function getRequestHandlers(): array |
|
| 86 | +{ |
|
| 87 | +return $this->aRequestHandlers; |
|
| 88 | +} |
|
| 89 | 89 | |
| 90 | - /** |
|
| 90 | +/** |
|
| 91 | 91 | * Register a plugin |
| 92 | 92 | * |
| 93 | 93 | * @param class-string $sClassName The plugin class |
@@ -97,40 +97,40 @@ discard block |
||
| 97 | 97 | * @return int |
| 98 | 98 | * @throws SetupException |
| 99 | 99 | */ |
| 100 | - private function _registerPlugin(string $sClassName, string $sPluginName, array $aInterfaces): int |
|
| 101 | - { |
|
| 102 | - // Any plugin must implement the PluginInterface interface. |
|
| 103 | - if(!in_array(PluginInterface::class, $aInterfaces)) |
|
| 104 | - { |
|
| 105 | - $sMessage = $this->xTranslator->trans('errors.register.invalid', [ |
|
| 106 | - 'name' => $sClassName, |
|
| 107 | - ]); |
|
| 108 | - throw new SetupException($sMessage); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - // Response plugin. |
|
| 112 | - if(in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
| 113 | - { |
|
| 114 | - $this->aResponsePlugins[$sPluginName] = $sClassName; |
|
| 115 | - return 1; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - // Request plugin. |
|
| 119 | - $nCount = 0; |
|
| 120 | - if(in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
| 121 | - { |
|
| 122 | - $this->aRegistryPlugins[$sPluginName] = $sClassName; |
|
| 123 | - $nCount++; |
|
| 124 | - } |
|
| 125 | - if(in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
| 126 | - { |
|
| 127 | - $this->aRequestHandlers[$sPluginName] = $sClassName; |
|
| 128 | - $nCount++; |
|
| 129 | - } |
|
| 130 | - return $nCount; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - /** |
|
| 100 | +private function _registerPlugin(string $sClassName, string $sPluginName, array $aInterfaces): int |
|
| 101 | +{ |
|
| 102 | +// Any plugin must implement the PluginInterface interface. |
|
| 103 | +if(!in_array(PluginInterface::class, $aInterfaces)) |
|
| 104 | +{ |
|
| 105 | +$sMessage = $this->xTranslator->trans('errors.register.invalid', [ |
|
| 106 | + 'name' => $sClassName, |
|
| 107 | +]); |
|
| 108 | +throw new SetupException($sMessage); |
|
| 109 | +} |
|
| 110 | + |
|
| 111 | +// Response plugin. |
|
| 112 | +if(in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
| 113 | +{ |
|
| 114 | +$this->aResponsePlugins[$sPluginName] = $sClassName; |
|
| 115 | +return 1; |
|
| 116 | +} |
|
| 117 | + |
|
| 118 | +// Request plugin. |
|
| 119 | +$nCount = 0; |
|
| 120 | +if(in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
| 121 | +{ |
|
| 122 | +$this->aRegistryPlugins[$sPluginName] = $sClassName; |
|
| 123 | +$nCount++; |
|
| 124 | +} |
|
| 125 | +if(in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
| 126 | +{ |
|
| 127 | +$this->aRequestHandlers[$sPluginName] = $sClassName; |
|
| 128 | +$nCount++; |
|
| 129 | +} |
|
| 130 | +return $nCount; |
|
| 131 | +} |
|
| 132 | + |
|
| 133 | +/** |
|
| 134 | 134 | * Register a plugin |
| 135 | 135 | * |
| 136 | 136 | * Below is a table for priorities and their description: |
@@ -145,34 +145,34 @@ discard block |
||
| 145 | 145 | * @return void |
| 146 | 146 | * @throws SetupException |
| 147 | 147 | */ |
| 148 | - public function registerPlugin(string $sClassName, string $sPluginName, int $nPriority = 1000): void |
|
| 149 | - { |
|
| 150 | - $aInterfaces = class_implements($sClassName); |
|
| 151 | - $nCount = $this->_registerPlugin($sClassName, $sPluginName, $aInterfaces); |
|
| 152 | - |
|
| 153 | - // Any plugin can implement the CodeGeneratorInterface interface. |
|
| 154 | - if(in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
| 155 | - { |
|
| 156 | - $this->xCodeGenerator->addCodeGenerator($sClassName, $nPriority); |
|
| 157 | - $nCount++; |
|
| 158 | - } |
|
| 159 | - // The class is not a valid plugin. |
|
| 160 | - if($nCount === 0) |
|
| 161 | - { |
|
| 162 | - $sMessage = $this->xTranslator->trans('errors.register.invalid', [ |
|
| 163 | - 'name' => $sClassName, |
|
| 164 | - ]); |
|
| 165 | - throw new SetupException($sMessage); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - // Register the plugin in the DI container, if necessary |
|
| 169 | - if(!$this->di->has($sClassName)) |
|
| 170 | - { |
|
| 171 | - $this->di->auto($sClassName); |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 148 | +public function registerPlugin(string $sClassName, string $sPluginName, int $nPriority = 1000): void |
|
| 149 | +{ |
|
| 150 | +$aInterfaces = class_implements($sClassName); |
|
| 151 | +$nCount = $this->_registerPlugin($sClassName, $sPluginName, $aInterfaces); |
|
| 152 | + |
|
| 153 | +// Any plugin can implement the CodeGeneratorInterface interface. |
|
| 154 | +if(in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
| 155 | +{ |
|
| 156 | +$this->xCodeGenerator->addCodeGenerator($sClassName, $nPriority); |
|
| 157 | +$nCount++; |
|
| 158 | +} |
|
| 159 | +// The class is not a valid plugin. |
|
| 160 | +if($nCount === 0) |
|
| 161 | +{ |
|
| 162 | +$sMessage = $this->xTranslator->trans('errors.register.invalid', [ |
|
| 163 | + 'name' => $sClassName, |
|
| 164 | +]); |
|
| 165 | +throw new SetupException($sMessage); |
|
| 166 | +} |
|
| 167 | + |
|
| 168 | +// Register the plugin in the DI container, if necessary |
|
| 169 | +if(!$this->di->has($sClassName)) |
|
| 170 | +{ |
|
| 171 | +$this->di->auto($sClassName); |
|
| 172 | +} |
|
| 173 | +} |
|
| 174 | + |
|
| 175 | +/** |
|
| 176 | 176 | * Find the specified response plugin by name or class name |
| 177 | 177 | * |
| 178 | 178 | * @template R of ResponsePluginInterface |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return ($sName is class-string ? R|null : ResponsePluginInterface|null) |
| 182 | 182 | */ |
| 183 | - public function getResponsePlugin(string $sName): ?ResponsePluginInterface |
|
| 184 | - { |
|
| 185 | - return $this->di->h($sName) ? $this->di->g($sName) : |
|
| 186 | - (!isset($this->aResponsePlugins[$sName]) ? null : |
|
| 187 | - $this->di->g($this->aResponsePlugins[$sName])); |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - /** |
|
| 183 | +public function getResponsePlugin(string $sName): ?ResponsePluginInterface |
|
| 184 | +{ |
|
| 185 | +return $this->di->h($sName) ? $this->di->g($sName) : |
|
| 186 | +(!isset($this->aResponsePlugins[$sName]) ? null : |
|
| 187 | +$this->di->g($this->aResponsePlugins[$sName])); |
|
| 188 | +} |
|
| 189 | + |
|
| 190 | +/** |
|
| 191 | 191 | * Register a callable function or class |
| 192 | 192 | * |
| 193 | 193 | * Call the request plugin with the $sType defined as name. |
@@ -199,46 +199,46 @@ discard block |
||
| 199 | 199 | * @return void |
| 200 | 200 | * @throws SetupException |
| 201 | 201 | */ |
| 202 | - public function registerCallable(string $sType, string $sCallable, $xOptions = []): void |
|
| 203 | - { |
|
| 204 | - if(isset($this->aRegistryPlugins[$sType]) && |
|
| 205 | - ($xPlugin = $this->di->g($this->aRegistryPlugins[$sType]))) |
|
| 206 | - { |
|
| 207 | - $xPlugin->register($sType, $sCallable, $xPlugin->checkOptions($sCallable, $xOptions)); |
|
| 208 | - return; |
|
| 209 | - } |
|
| 210 | - throw new SetupException($this->xTranslator->trans('errors.register.plugin', |
|
| 211 | - ['name' => $sType, 'callable' => $sCallable])); |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - /** |
|
| 202 | +public function registerCallable(string $sType, string $sCallable, $xOptions = []): void |
|
| 203 | +{ |
|
| 204 | +if(isset($this->aRegistryPlugins[$sType]) && |
|
| 205 | +($xPlugin = $this->di->g($this->aRegistryPlugins[$sType]))) |
|
| 206 | +{ |
|
| 207 | +$xPlugin->register($sType, $sCallable, $xPlugin->checkOptions($sCallable, $xOptions)); |
|
| 208 | +return; |
|
| 209 | +} |
|
| 210 | +throw new SetupException($this->xTranslator->trans('errors.register.plugin', |
|
| 211 | +['name' => $sType, 'callable' => $sCallable])); |
|
| 212 | +} |
|
| 213 | + |
|
| 214 | +/** |
|
| 215 | 215 | * Register the Jaxon request plugins |
| 216 | 216 | * |
| 217 | 217 | * @return void |
| 218 | 218 | * @throws SetupException |
| 219 | 219 | */ |
| 220 | - public function registerPlugins(): void |
|
| 221 | - { |
|
| 222 | - // Request plugins |
|
| 223 | - $this->registerPlugin(CallableClassPlugin::class, Jaxon::CALLABLE_CLASS, 101); |
|
| 224 | - $this->registerPlugin(CallableFunctionPlugin::class, Jaxon::CALLABLE_FUNCTION, 102); |
|
| 225 | - $this->registerPlugin(CallableDirPlugin::class, Jaxon::CALLABLE_DIR, 103); |
|
| 226 | - |
|
| 227 | - // Response plugins |
|
| 228 | - $this->registerPlugin(ScriptPlugin::class, ScriptPlugin::NAME, 700); |
|
| 229 | - $this->registerPlugin(DatabagPlugin::class, DatabagPlugin::NAME, 700); |
|
| 230 | - $this->registerPlugin(DialogPlugin::class, DialogPlugin::NAME, 750); |
|
| 231 | - $this->registerPlugin(PaginatorPlugin::class, PaginatorPlugin::NAME, 800); |
|
| 232 | - $this->registerPlugin(PsrPlugin::class, PsrPlugin::NAME, 850); |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - /** |
|
| 220 | +public function registerPlugins(): void |
|
| 221 | +{ |
|
| 222 | +// Request plugins |
|
| 223 | +$this->registerPlugin(CallableClassPlugin::class, Jaxon::CALLABLE_CLASS, 101); |
|
| 224 | +$this->registerPlugin(CallableFunctionPlugin::class, Jaxon::CALLABLE_FUNCTION, 102); |
|
| 225 | +$this->registerPlugin(CallableDirPlugin::class, Jaxon::CALLABLE_DIR, 103); |
|
| 226 | + |
|
| 227 | +// Response plugins |
|
| 228 | +$this->registerPlugin(ScriptPlugin::class, ScriptPlugin::NAME, 700); |
|
| 229 | +$this->registerPlugin(DatabagPlugin::class, DatabagPlugin::NAME, 700); |
|
| 230 | +$this->registerPlugin(DialogPlugin::class, DialogPlugin::NAME, 750); |
|
| 231 | +$this->registerPlugin(PaginatorPlugin::class, PaginatorPlugin::NAME, 800); |
|
| 232 | +$this->registerPlugin(PsrPlugin::class, PsrPlugin::NAME, 850); |
|
| 233 | +} |
|
| 234 | + |
|
| 235 | +/** |
|
| 236 | 236 | * Get the parameter reader |
| 237 | 237 | * |
| 238 | 238 | * @return ParameterReader |
| 239 | 239 | */ |
| 240 | - public function getParameterReader(): ParameterReader |
|
| 241 | - { |
|
| 242 | - return $this->di->g(ParameterReader::class); |
|
| 243 | - } |
|
| 240 | +public function getParameterReader(): ParameterReader |
|
| 241 | +{ |
|
| 242 | +return $this->di->g(ParameterReader::class); |
|
| 243 | +} |
|
| 244 | 244 | } |
@@ -19,46 +19,46 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | abstract class AbstractPackage extends AbstractCodeGenerator |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * The configuration options of the package |
| 24 | 24 | * |
| 25 | 25 | * @var Config |
| 26 | 26 | */ |
| 27 | - protected $xPkgConfig; |
|
| 27 | +protected $xPkgConfig; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * The view renderer |
| 31 | 31 | * |
| 32 | 32 | * @var ViewRenderer |
| 33 | 33 | */ |
| 34 | - protected $xRenderer; |
|
| 34 | +protected $xRenderer; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * Get the path to the config file, or the config options in an array. |
| 38 | 38 | * |
| 39 | 39 | * @return string|array |
| 40 | 40 | */ |
| 41 | - abstract public static function config(): string|array; |
|
| 41 | +abstract public static function config(): string|array; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * Get the package config object |
| 45 | 45 | * |
| 46 | 46 | * @return Config |
| 47 | 47 | */ |
| 48 | - final public function getConfig(): Config |
|
| 49 | - { |
|
| 50 | - return $this->xPkgConfig; |
|
| 51 | - } |
|
| 48 | +final public function getConfig(): Config |
|
| 49 | +{ |
|
| 50 | +return $this->xPkgConfig; |
|
| 51 | +} |
|
| 52 | 52 | |
| 53 | - /** |
|
| 53 | +/** |
|
| 54 | 54 | * This method is automatically called after the package instance is created and configured. |
| 55 | 55 | * |
| 56 | 56 | * @return void |
| 57 | 57 | */ |
| 58 | - protected function init(): void |
|
| 59 | - {} |
|
| 58 | +protected function init(): void |
|
| 59 | +{} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * Get the value of a given package option |
| 63 | 63 | * |
| 64 | 64 | * @param string $sOption The option name |
@@ -66,59 +66,59 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | - final public function getOption(string $sOption, $xDefault = null): mixed |
|
| 70 | - { |
|
| 71 | - return $this->xPkgConfig->getOption($sOption, $xDefault); |
|
| 72 | - } |
|
| 69 | +final public function getOption(string $sOption, $xDefault = null): mixed |
|
| 70 | +{ |
|
| 71 | +return $this->xPkgConfig->getOption($sOption, $xDefault); |
|
| 72 | +} |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | +/** |
|
| 75 | 75 | * Get the view renderer |
| 76 | 76 | * |
| 77 | 77 | * @return ViewRenderer |
| 78 | 78 | */ |
| 79 | - final public function view(): ViewRenderer |
|
| 80 | - { |
|
| 81 | - return $this->xRenderer; |
|
| 82 | - } |
|
| 79 | +final public function view(): ViewRenderer |
|
| 80 | +{ |
|
| 81 | +return $this->xRenderer; |
|
| 82 | +} |
|
| 83 | 83 | |
| 84 | - /** |
|
| 84 | +/** |
|
| 85 | 85 | * @inheritDoc |
| 86 | 86 | */ |
| 87 | - final public function getHash(): string |
|
| 88 | - { |
|
| 89 | - // Packages do not generate hash on their own. So we make this method final. |
|
| 90 | - return ''; |
|
| 91 | - } |
|
| 87 | +final public function getHash(): string |
|
| 88 | +{ |
|
| 89 | +// Packages do not generate hash on their own. So we make this method final. |
|
| 90 | +return ''; |
|
| 91 | +} |
|
| 92 | 92 | |
| 93 | - /** |
|
| 93 | +/** |
|
| 94 | 94 | * Get the HTML code of the package home page |
| 95 | 95 | * |
| 96 | 96 | * @return string|Stringable |
| 97 | 97 | */ |
| 98 | - public function getHtml(): string|Stringable |
|
| 99 | - { |
|
| 100 | - return ''; |
|
| 101 | - } |
|
| 98 | +public function getHtml(): string|Stringable |
|
| 99 | +{ |
|
| 100 | +return ''; |
|
| 101 | +} |
|
| 102 | 102 | |
| 103 | - /** |
|
| 103 | +/** |
|
| 104 | 104 | * Get the HTML code of the package home page |
| 105 | 105 | * |
| 106 | 106 | * This method is an alias for getHtml(). |
| 107 | 107 | * |
| 108 | 108 | * @return string|Stringable |
| 109 | 109 | */ |
| 110 | - public function html(): string|Stringable |
|
| 111 | - { |
|
| 112 | - return $this->getHtml(); |
|
| 113 | - } |
|
| 110 | +public function html(): string|Stringable |
|
| 111 | +{ |
|
| 112 | +return $this->getHtml(); |
|
| 113 | +} |
|
| 114 | 114 | |
| 115 | - /** |
|
| 115 | +/** |
|
| 116 | 116 | * Get the Js code of the ready() callback |
| 117 | 117 | * |
| 118 | 118 | * @return string|Stringable |
| 119 | 119 | */ |
| 120 | - public function getReadyScript(): string|Stringable |
|
| 121 | - { |
|
| 122 | - return ''; |
|
| 123 | - } |
|
| 120 | +public function getReadyScript(): string|Stringable |
|
| 121 | +{ |
|
| 122 | +return ''; |
|
| 123 | +} |
|
| 124 | 124 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function addCodeGenerator(string $sClassName, int $nPriority): void |
| 111 | 111 | { |
| 112 | - while(isset($this->aCodeGenerators[$nPriority])) |
|
| 112 | + while (isset($this->aCodeGenerators[$nPriority])) |
|
| 113 | 113 | { |
| 114 | 114 | $nPriority++; |
| 115 | 115 | } |
@@ -163,33 +163,33 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | private function generatePluginCodes(CodeGeneratorInterface $xGenerator): void |
| 165 | 165 | { |
| 166 | - if(!is_subclass_of($xGenerator, AbstractPlugin::class) || |
|
| 166 | + if (!is_subclass_of($xGenerator, AbstractPlugin::class) || |
|
| 167 | 167 | $this->xAssetManager->shallIncludeAssets($xGenerator)) |
| 168 | 168 | { |
| 169 | 169 | // HTML tags for CSS |
| 170 | - if(($sCss = trim($xGenerator->getCss(), " \n")) !== '') |
|
| 170 | + if (($sCss = trim($xGenerator->getCss(), " \n")) !== '') |
|
| 171 | 171 | { |
| 172 | 172 | $this->aCss[] = $sCss; |
| 173 | 173 | } |
| 174 | 174 | // HTML tags for js |
| 175 | - if(($sJs = trim($xGenerator->getJs(), " \n")) !== '') |
|
| 175 | + if (($sJs = trim($xGenerator->getJs(), " \n")) !== '') |
|
| 176 | 176 | { |
| 177 | 177 | $this->aJs[] = $sJs; |
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // Additional js codes |
| 182 | - if(($xJsCode = $xGenerator->getJsCode()) !== null) |
|
| 182 | + if (($xJsCode = $xGenerator->getJsCode()) !== null) |
|
| 183 | 183 | { |
| 184 | - if(($sJs = trim($xJsCode->sJs, " \n")) !== '') |
|
| 184 | + if (($sJs = trim($xJsCode->sJs, " \n")) !== '') |
|
| 185 | 185 | { |
| 186 | 186 | $this->aCodeJs[] = $sJs; |
| 187 | 187 | } |
| 188 | - if(($sJsBefore = trim($xJsCode->sJsBefore, " \n")) !== '') |
|
| 188 | + if (($sJsBefore = trim($xJsCode->sJsBefore, " \n")) !== '') |
|
| 189 | 189 | { |
| 190 | 190 | $this->aCodeJsBefore[] = $sJsBefore; |
| 191 | 191 | } |
| 192 | - if(($sJsAfter = trim($xJsCode->sJsAfter, " \n")) !== '') |
|
| 192 | + if (($sJsAfter = trim($xJsCode->sJsAfter, " \n")) !== '') |
|
| 193 | 193 | { |
| 194 | 194 | $this->aCodeJsAfter[] = $sJsAfter; |
| 195 | 195 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | private function generateCodes(): void |
| 207 | 207 | { |
| 208 | - if($this->bGenerated) |
|
| 208 | + if ($this->bGenerated) |
|
| 209 | 209 | { |
| 210 | 210 | return; |
| 211 | 211 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | // Sort the code generators by ascending priority |
| 217 | 217 | ksort($this->aCodeGenerators); |
| 218 | 218 | |
| 219 | - foreach($this->aCodeGenerators as $sClassName) |
|
| 219 | + foreach ($this->aCodeGenerators as $sClassName) |
|
| 220 | 220 | { |
| 221 | 221 | $this->generatePluginCodes($this->getCodeGenerator($sClassName)); |
| 222 | 222 | } |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | public function getJsScript(): string |
| 263 | 263 | { |
| 264 | 264 | $aJsScripts = []; |
| 265 | - foreach($this->aCodeGenerators as $sClassName) |
|
| 265 | + foreach ($this->aCodeGenerators as $sClassName) |
|
| 266 | 266 | { |
| 267 | 267 | $xGenerator = $this->getCodeGenerator($sClassName); |
| 268 | 268 | // Javascript code |
| 269 | - if(($sJsScript = trim($xGenerator->getScript(), " \n")) !== '') |
|
| 269 | + if (($sJsScript = trim($xGenerator->getScript(), " \n")) !== '') |
|
| 270 | 270 | { |
| 271 | 271 | $aJsScripts[] = $sJsScript; |
| 272 | 272 | } |
@@ -283,38 +283,36 @@ discard block |
||
| 283 | 283 | private function renderCodes(bool $bIncludeJs, bool $bIncludeCss): array |
| 284 | 284 | { |
| 285 | 285 | $aCodes = []; |
| 286 | - if($bIncludeCss) |
|
| 286 | + if ($bIncludeCss) |
|
| 287 | 287 | { |
| 288 | 288 | $aCodes[] = $this->getCss(); |
| 289 | 289 | } |
| 290 | - if($bIncludeJs) |
|
| 290 | + if ($bIncludeJs) |
|
| 291 | 291 | { |
| 292 | 292 | $aCodes[] = $this->getJs(); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - $sUrl = !$this->xAssetManager->shallCreateJsFiles() ? '' : |
|
| 296 | - $this->xAssetManager->createJsFiles($this); |
|
| 295 | + $sUrl = !$this->xAssetManager->shallCreateJsFiles() ? '' : $this->xAssetManager->createJsFiles($this); |
|
| 297 | 296 | // Wrap the js code into the corresponding HTML tag. |
| 298 | 297 | $aCodes[] = $sUrl !== '' ? |
| 299 | - $this->render('include.js', ['sUrl' => $sUrl]) : |
|
| 300 | - $this->render('wrapper.js', ['sScript' => $this->getJsScript()]); |
|
| 298 | + $this->render('include.js', ['sUrl' => $sUrl]) : $this->render('wrapper.js', ['sScript' => $this->getJsScript()]); |
|
| 301 | 299 | |
| 302 | 300 | // Wrap the js codes into HTML tags. |
| 303 | - if(count($this->aCodeJsBefore) > 0) |
|
| 301 | + if (count($this->aCodeJsBefore) > 0) |
|
| 304 | 302 | { |
| 305 | 303 | $sScript = implode("\n\n", $this->aCodeJsBefore); |
| 306 | 304 | $aCodes[] = $this->render('wrapper.js', ['sScript' => $sScript]); |
| 307 | 305 | } |
| 308 | - if(count($this->aCodeJs) > 0) |
|
| 306 | + if (count($this->aCodeJs) > 0) |
|
| 309 | 307 | { |
| 310 | 308 | $sScript = implode("\n\n", $this->aCodeJs); |
| 311 | 309 | $aCodes[] = $this->render('wrapper.js', ['sScript' => $sScript]); |
| 312 | 310 | } |
| 313 | - if(count($this->aCodeJsFiles) > 0) |
|
| 311 | + if (count($this->aCodeJsFiles) > 0) |
|
| 314 | 312 | { |
| 315 | 313 | $aCodes[] = $this->render('includes.js', ['aUrls' => $this->aCodeJsFiles]); |
| 316 | 314 | } |
| 317 | - if(count($this->aCodeJsAfter) > 0) |
|
| 315 | + if (count($this->aCodeJsAfter) > 0) |
|
| 318 | 316 | { |
| 319 | 317 | $sScript = implode("\n\n", $this->aCodeJsAfter); |
| 320 | 318 | $aCodes[] = $this->render('wrapper.js', ['sScript' => $sScript]); |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | try |
| 122 | 122 | {
|
| 123 | 123 | $xFilesystem->createDirectory($sUploadDir); |
| 124 | - if(!$xFilesystem->directoryExists($sUploadDir)) |
|
| 124 | + if (!$xFilesystem->directoryExists($sUploadDir)) |
|
| 125 | 125 | {
|
| 126 | 126 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
| 127 | 127 | } |
| 128 | 128 | return $sUploadDir; |
| 129 | 129 | } |
| 130 | - catch(FilesystemException $e) |
|
| 130 | + catch (FilesystemException $e) |
|
| 131 | 131 | {
|
| 132 | 132 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 133 | 133 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | {
|
| 163 | 163 | // Check the uploaded file validity |
| 164 | 164 | $nErrorCode = $xHttpFile->getError(); |
| 165 | - if($nErrorCode !== UPLOAD_ERR_OK) |
|
| 165 | + if ($nErrorCode !== UPLOAD_ERR_OK) |
|
| 166 | 166 | {
|
| 167 | 167 | $this->xLogger->error('File upload error.', [
|
| 168 | 168 | 'code' => $nErrorCode, |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | // Filename without the extension. Needs to be sanitized. |
| 178 | 178 | $sName = pathinfo($xHttpFile->getClientFilename(), PATHINFO_FILENAME); |
| 179 | - if($this->cNameSanitizer !== null) |
|
| 179 | + if ($this->cNameSanitizer !== null) |
|
| 180 | 180 | {
|
| 181 | 181 | $sName = (string)call_user_func($this->cNameSanitizer, |
| 182 | 182 | $sName, $sField, $this->sUploadFieldId); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | // Set the user file data |
| 186 | 186 | $xFile = File::fromHttpFile($this->xFileStorage->filesystem($sField), $xHttpFile, $sUploadDir, $sName); |
| 187 | 187 | // Verify file validity (format, size) |
| 188 | - if(!$this->xValidator->validateUploadedFile($sField, $xFile)) |
|
| 188 | + if (!$this->xValidator->validateUploadedFile($sField, $xFile)) |
|
| 189 | 189 | {
|
| 190 | 190 | throw new RequestException($this->xValidator->getErrorMessage()); |
| 191 | 191 | } |
@@ -209,16 +209,16 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | $aUserFiles = []; |
| 211 | 211 | $aAllFiles = []; // A flat list of all uploaded files |
| 212 | - foreach($aTempFiles as $sField => $aFiles) |
|
| 212 | + foreach ($aTempFiles as $sField => $aFiles) |
|
| 213 | 213 | {
|
| 214 | 214 | $aUserFiles[$sField] = []; |
| 215 | 215 | // Get the path to the upload dir |
| 216 | 216 | $sUploadDir = $this->getUploadDir($sField); |
| 217 | - if(!is_array($aFiles)) |
|
| 217 | + if (!is_array($aFiles)) |
|
| 218 | 218 | {
|
| 219 | 219 | $aFiles = [$aFiles]; |
| 220 | 220 | } |
| 221 | - foreach($aFiles as $xHttpFile) |
|
| 221 | + foreach ($aFiles as $xHttpFile) |
|
| 222 | 222 | {
|
| 223 | 223 | $aFile = $this->makeUploadedFile($xHttpFile, $sUploadDir, $sField); |
| 224 | 224 | $aUserFiles[$sField][] = $aFile['user']; |
@@ -229,14 +229,14 @@ discard block |
||
| 229 | 229 | // Copy the uploaded files from the temp dir to the user dir |
| 230 | 230 | try |
| 231 | 231 | {
|
| 232 | - foreach($aAllFiles as $aFiles) |
|
| 232 | + foreach ($aAllFiles as $aFiles) |
|
| 233 | 233 | {
|
| 234 | 234 | $sPath = $aFiles['user']->path(); |
| 235 | 235 | $xContent = $aFiles['temp']->getStream(); |
| 236 | 236 | $aFiles['user']->filesystem()->write($sPath, $xContent); |
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | - catch(FilesystemException $e) |
|
| 239 | + catch (FilesystemException $e) |
|
| 240 | 240 | {
|
| 241 | 241 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 242 | 242 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
@@ -126,8 +126,7 @@ discard block |
||
| 126 | 126 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
| 127 | 127 | } |
| 128 | 128 | return $sUploadDir; |
| 129 | - } |
|
| 130 | - catch(FilesystemException $e) |
|
| 129 | + } catch(FilesystemException $e) |
|
| 131 | 130 | {
|
| 132 | 131 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 133 | 132 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|
@@ -235,8 +234,7 @@ discard block |
||
| 235 | 234 | $xContent = $aFiles['temp']->getStream(); |
| 236 | 235 | $aFiles['user']->filesystem()->write($sPath, $xContent); |
| 237 | 236 | } |
| 238 | - } |
|
| 239 | - catch(FilesystemException $e) |
|
| 237 | + } catch(FilesystemException $e) |
|
| 240 | 238 | {
|
| 241 | 239 | $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
|
| 242 | 240 | throw new RequestException($this->xTranslator->trans('errors.upload.access'));
|