Passed
Push — main ( 957ef0...483b9f )
by Thierry
04:08
created
jaxon-core/src/App/Dialog/AlertInterface.php 1 patch
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
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 2 patches
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.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,8 +126,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'));
Please login to merge, or discard this patch.
jaxon-upload/src/register.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 function registerUpload(): void
24 24
 {
25 25
     $jaxon = jaxon();
26
-    if(!$jaxon->getOption('upload.enabled') && !$jaxon->getOption('core.upload.enabled'))
26
+    if (!$jaxon->getOption('upload.enabled') && !$jaxon->getOption('core.upload.enabled'))
27 27
     {
28 28
         return;
29 29
     }
30 30
 
31 31
     $di = $jaxon->di();
32
-    if($di->h(UploadHandler::class))
32
+    if ($di->h(UploadHandler::class))
33 33
     {
34 34
         return;
35 35
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         $xUploadHandler = $di->g(UploadHandler::class);
80 80
         // The HTTP request
81 81
         $xRequest = $di->getRequest();
82
-        if($xUploadHandler->canProcessRequest($xRequest))
82
+        if ($xUploadHandler->canProcessRequest($xRequest))
83 83
         {
84 84
             $xUploadHandler->processRequest($xRequest);
85 85
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 function register()
101 101
 {
102 102
     // Do nothing if running in cli.
103
-    if(php_sapi_name() !== 'cli')
103
+    if (php_sapi_name() !== 'cli')
104 104
     {
105 105
         _register();
106 106
     };
Please login to merge, or discard this patch.