Passed
Push — main ( 8fa9e1...957ef0 )
by Thierry
06:37
created
jaxon-core/src/Request/Handler/ParameterReader.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
     private function decoderUtf8Str(string $sStr): string
81 81
     {
82 82
         $sEncoding = $this->xConfigManager->getOption('core.encoding', '');
83
-        if(function_exists('iconv'))
83
+        if (function_exists('iconv'))
84 84
         {
85 85
             return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr);
86 86
         }
87
-        if(function_exists('mb_convert_encoding'))
87
+        if (function_exists('mb_convert_encoding'))
88 88
         {
89 89
             return mb_convert_encoding($sStr, $sEncoding, "UTF-8");
90 90
         }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     private function decodeRequestParameter(string $sParam): string
104 104
     {
105 105
         $sParam = $this->decodeStr($sParam);
106
-        if(!$this->xConfigManager->getOption('core.decode_utf8'))
106
+        if (!$this->xConfigManager->getOption('core.decode_utf8'))
107 107
         {
108 108
             return $sParam;
109 109
         }
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
         $aBody = $xRequest->getParsedBody();
122 122
         $aParams = is_array($aBody) ? $aBody : $xRequest->getQueryParams();
123 123
         // Check if Jaxon call parameters are present.
124
-        if(isset($aParams['jxncall']) && is_string($aParams['jxncall']))
124
+        if (isset($aParams['jxncall']) && is_string($aParams['jxncall']))
125 125
         {
126 126
             $xRequest = $xRequest->withAttribute('jxncall', json_decode($this
127 127
                 ->decodeRequestParameter($aParams['jxncall']), true));
128 128
         }
129 129
         // Check if Jaxon bags parameters are present.
130
-        if(isset($aParams['jxnbags']) && is_string($aParams['jxnbags']))
130
+        if (isset($aParams['jxnbags']) && is_string($aParams['jxnbags']))
131 131
         {
132 132
             $xRequest = $xRequest->withAttribute('jxnbags', json_decode($this
133 133
                 ->decodeRequestParameter($aParams['jxnbags']), true));
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Response/Databag/DatabagPlugin.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     private function initDatabag(): void
36 36
     {
37
-        if($this->xDatabag !== null)
37
+        if ($this->xDatabag !== null)
38 38
         {
39 39
             return;
40 40
         }
@@ -62,8 +62,7 @@  discard block
 block discarded – undo
62 62
         // Todo: clean input data.
63 63
         // Todo: verify the checksums.
64 64
         return is_string($xData) ?
65
-            (json_decode($xData, true) ?: []) :
66
-            (is_array($xData) ? $xData : []);
65
+            (json_decode($xData, true) ?: []) : (is_array($xData) ? $xData : []);
67 66
     }
68 67
 
69 68
     /**
@@ -81,7 +80,7 @@  discard block
 block discarded – undo
81 80
     public function writeCommand(): void
82 81
     {
83 82
         $this->initDatabag();
84
-        if($this->xDatabag->touched())
83
+        if ($this->xDatabag->touched())
85 84
         {
86 85
             // Todo: calculate the checksums.
87 86
             $this->addCommand('databag.set', ['values' => $this->xDatabag]);
Please login to merge, or discard this patch.
jaxon-core/templates/callables/objects.js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
   rc: (name, method, parameters, options = {}) => jaxon.request({ type: 'class', name, method }, { parameters, ...options}),
3 3
   rf: (name, parameters, options = {}) => jaxon.request({ type: 'func', name }, { parameters, ...options}),
4 4
 <?php
5
-foreach($this->aCallableNames as $nIndex => $sName):
5
+foreach ($this->aCallableNames as $nIndex => $sName):
6 6
   echo "  c$nIndex: '$sName',\n";
7 7
 endforeach
8 8
 ?>
Please login to merge, or discard this patch.
jaxon-upload/src/Manager/Validator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty);
85 85
         $aAllowed = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
86
-        if(is_array($aAllowed) && !in_array($sValue, $aAllowed))
86
+        if (is_array($aAllowed) && !in_array($sValue, $aAllowed))
87 87
         {
88 88
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sField, [$sField => $sValue]);
89 89
             return false;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty, 0);
106 106
         $nSize = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
107
-        if($nSize > 0 && (
107
+        if ($nSize > 0 && (
108 108
             ($sProperty == 'max-size' && $nFileSize > $nSize) ||
109 109
             ($sProperty == 'min-size' && $nFileSize < $nSize)))
110 110
         {
@@ -126,25 +126,25 @@  discard block
 block discarded – undo
126 126
     {
127 127
         $this->sErrorMessage = '';
128 128
         // Verify the file extension
129
-        if(!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type'))
129
+        if (!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type'))
130 130
         {
131 131
             return false;
132 132
         }
133 133
 
134 134
         // Verify the file extension
135
-        if(!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension'))
135
+        if (!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension'))
136 136
         {
137 137
             return false;
138 138
         }
139 139
 
140 140
         // Verify the max size
141
-        if(!$this->validateFileSize($sVarName, $xFile->size(), 'max-size'))
141
+        if (!$this->validateFileSize($sVarName, $xFile->size(), 'max-size'))
142 142
         {
143 143
             return false;
144 144
         }
145 145
 
146 146
         // Verify the min size
147
-        if(!$this->validateFileSize($sVarName, $xFile->size(), 'min-size'))
147
+        if (!$this->validateFileSize($sVarName, $xFile->size(), 'min-size'))
148 148
         {
149 149
             return false;
150 150
         }
Please login to merge, or discard this patch.
jaxon-upload/src/Manager/UploadManager.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'));
Please login to merge, or discard this patch.