Completed
Push — master ( 1cd1d8...dbc4d9 )
by Thierry
02:53
created
src/Request/Plugin/CallableDir.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -97,68 +97,68 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function register($sType, $sDirectory, $aOptions)
99 99
     {
100
-        if($sType != $this->getName())
100
+        if ($sType != $this->getName())
101 101
         {
102 102
             return false;
103 103
         }
104 104
 
105
-        if(!is_string($sDirectory) || !is_dir($sDirectory))
105
+        if (!is_string($sDirectory) || !is_dir($sDirectory))
106 106
         {
107 107
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
108 108
         }
109 109
         $sDirectory = trim($sDirectory, DIRECTORY_SEPARATOR);
110 110
         $this->aCallableDirs[] = $sDirectory;
111 111
 
112
-        if(is_string($aOptions))
112
+        if (is_string($aOptions))
113 113
         {
114 114
             $aOptions = ['namespace' => $aOptions];
115 115
         }
116
-        if(!is_array($aOptions))
116
+        if (!is_array($aOptions))
117 117
         {
118 118
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
119 119
         }
120 120
 
121
-        if(!is_dir(($sDirectory = trim($sDirectory))))
121
+        if (!is_dir(($sDirectory = trim($sDirectory))))
122 122
         {
123 123
             return false;
124 124
         }
125 125
 
126 126
         $aProtected = key_exists('protected', $aOptions) ? $aOptions['protected'] : [];
127
-        if(!is_array($aProtected))
127
+        if (!is_array($aProtected))
128 128
         {
129 129
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
130 130
         }
131 131
 
132 132
         $sSeparator = key_exists('separator', $aOptions) ? $aOptions['separator'] : '.';
133 133
         // Only '.' and '_' are allowed to be used as separator. Any other value is ignored and '.' is used instead.
134
-        if(($sSeparator = trim($sSeparator)) != '_')
134
+        if (($sSeparator = trim($sSeparator)) != '_')
135 135
         {
136 136
             $sSeparator = '.';
137 137
         }
138 138
 
139 139
         $sNamespace = key_exists('namespace', $aOptions) ? $aOptions['namespace'] : '';
140
-        if(!($sNamespace = trim($sNamespace, ' \\')))
140
+        if (!($sNamespace = trim($sNamespace, ' \\')))
141 141
         {
142 142
             $sNamespace = '';
143 143
         }
144
-        if(($sNamespace))
144
+        if (($sNamespace))
145 145
         {
146 146
             // If there is an autoloader, register the dir with PSR4 autoloading
147
-            if(($this->xAutoloader))
147
+            if (($this->xAutoloader))
148 148
             {
149 149
                 $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory);
150 150
             }
151 151
         }
152
-        elseif(($this->xAutoloader))
152
+        elseif (($this->xAutoloader))
153 153
         {
154 154
             // If there is an autoloader, register the dir with classmap autoloading
155 155
             $itDir = new RecursiveDirectoryIterator($sDirectory);
156 156
             $itFile = new RecursiveIteratorIterator($itDir);
157 157
             // Iterate on dir content
158
-            foreach($itFile as $xFile)
158
+            foreach ($itFile as $xFile)
159 159
             {
160 160
                 // skip everything except PHP files
161
-                if(!$xFile->isFile() || $xFile->getExtension() != 'php')
161
+                if (!$xFile->isFile() || $xFile->getExtension() != 'php')
162 162
                 {
163 163
                     continue;
164 164
                 }
@@ -195,33 +195,33 @@  discard block
 block discarded – undo
195 195
         $sClassPath = substr($xFile->getPath(), strlen($sDirectory));
196 196
         $sClassPath = str_replace($sDS, '\\', trim($sClassPath, $sDS));
197 197
         $sClassName = $xFile->getBasename('.php');
198
-        if(($sNamespace))
198
+        if (($sNamespace))
199 199
         {
200 200
             $sClassPath = ($sClassPath) ? $sNamespace . '\\' . $sClassPath : $sNamespace;
201 201
             $sClassName = '\\' . $sClassPath . '\\' . $sClassName;
202 202
         }
203 203
         // Require the file only if autoload is enabled but there is no autoloader
204
-        if(($this->bAutoloadEnabled) && !($this->xAutoloader))
204
+        if (($this->bAutoloadEnabled) && !($this->xAutoloader))
205 205
         {
206 206
             require_once($xFile->getPathname());
207 207
         }
208 208
         // Create and register an instance of the class
209
-        if(!array_key_exists('*', $aOptions) || !is_array($aOptions['*']))
209
+        if (!array_key_exists('*', $aOptions) || !is_array($aOptions['*']))
210 210
         {
211 211
             $aOptions['*'] = [];
212 212
         }
213 213
         $aOptions['*']['separator'] = $sSeparator;
214
-        if(($sNamespace))
214
+        if (($sNamespace))
215 215
         {
216 216
             $aOptions['*']['namespace'] = $sNamespace;
217 217
         }
218
-        if(($sClassPath))
218
+        if (($sClassPath))
219 219
         {
220 220
             $aOptions['*']['classpath'] = $sClassPath;
221 221
         }
222 222
         // Filter excluded methods
223
-        $aProtected = array_filter($aProtected, function ($sName) {return is_string($sName);});
224
-        if(count($aProtected) > 0)
223
+        $aProtected = array_filter($aProtected, function($sName) {return is_string($sName); });
224
+        if (count($aProtected) > 0)
225 225
         {
226 226
             $aOptions['*']['protected'] = $aProtected;
227 227
         }
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
         $sDS = DIRECTORY_SEPARATOR;
245 245
         // Change the keys in $aOptions to have "\" as separator
246 246
         $aNewOptions = [];
247
-        foreach($aOptions as $key => $aOption)
247
+        foreach ($aOptions as $key => $aOption)
248 248
         {
249 249
             $key = trim(str_replace(['.', '_'], ['\\', '\\'], $key), ' \\');
250 250
             $aNewOptions[$key] = $aOption;
251 251
         }
252 252
 
253
-        foreach($this->aCallableDirs as $sDirectory => $aDirOptions)
253
+        foreach ($this->aCallableDirs as $sDirectory => $aDirOptions)
254 254
         {
255 255
             // Get the namespace
256 256
             $sNamespace = $aDirOptions['namespace'];
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
             $itDir = new RecursiveDirectoryIterator($sDirectory);
259 259
             $itFile = new RecursiveIteratorIterator($itDir);
260 260
             // Iterate on dir content
261
-            foreach($itFile as $xFile)
261
+            foreach ($itFile as $xFile)
262 262
             {
263 263
                 // skip everything except PHP files
264
-                if(!$xFile->isFile() || $xFile->getExtension() != 'php')
264
+                if (!$xFile->isFile() || $xFile->getExtension() != 'php')
265 265
                 {
266 266
                     continue;
267 267
                 }
@@ -270,17 +270,17 @@  discard block
 block discarded – undo
270 270
                 $sClassPath = substr($xFile->getPath(), strlen($sDirectory));
271 271
                 $sClassPath = trim(str_replace($sDS, '\\', $sClassPath), '\\');
272 272
                 $sClassName = $xFile->getBasename('.php');
273
-                if(($sClassPath))
273
+                if (($sClassPath))
274 274
                 {
275 275
                     $sClassName = $sClassPath . '\\' . $sClassName;
276 276
                 }
277
-                if(($sNamespace))
277
+                if (($sNamespace))
278 278
                 {
279 279
                     $sClassName = $sNamespace . '\\' . $sClassName;
280 280
                 }
281 281
                 // Get the class options
282 282
                 $aClassOptions = [];
283
-                if(array_key_exists($sClassName, $aNewOptions))
283
+                if (array_key_exists($sClassName, $aNewOptions))
284 284
                 {
285 285
                     $aClassOptions = $aNewOptions[$sClassName];
286 286
                 }
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
      */
299 299
     public function generateHash()
300 300
     {
301
-        if(count($this->aCallableDirs) == 0)
301
+        if (count($this->aCallableDirs) == 0)
302 302
         {
303 303
             return '';
304 304
         }
305 305
         $sHash = '';
306
-        foreach($this->aCallableDirs as $sDirectory => $aDirOptions)
306
+        foreach ($this->aCallableDirs as $sDirectory => $aDirOptions)
307 307
         {
308 308
             $sHash .= $sDirectory . $aDirOptions['namespace'] . $aDirOptions['separator'];
309 309
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -148,8 +148,7 @@
 block discarded – undo
148 148
             {
149 149
                 $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory);
150 150
             }
151
-        }
152
-        elseif(($this->xAutoloader))
151
+        } elseif(($this->xAutoloader))
153 152
         {
154 153
             // If there is an autoloader, register the dir with classmap autoloading
155 154
             $itDir = new RecursiveDirectoryIterator($sDirectory);
Please login to merge, or discard this patch.
src/Request/Plugin/CallableClass.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function __construct()
63 63
     {
64
-        if(!empty($_GET['jxncls']))
64
+        if (!empty($_GET['jxncls']))
65 65
         {
66 66
             $this->sRequestedClass = $_GET['jxncls'];
67 67
         }
68
-        if(!empty($_GET['jxnmthd']))
68
+        if (!empty($_GET['jxnmthd']))
69 69
         {
70 70
             $this->sRequestedMethod = $_GET['jxnmthd'];
71 71
         }
72
-        if(!empty($_POST['jxncls']))
72
+        if (!empty($_POST['jxncls']))
73 73
         {
74 74
             $this->sRequestedClass = $_POST['jxncls'];
75 75
         }
76
-        if(!empty($_POST['jxnmthd']))
76
+        if (!empty($_POST['jxnmthd']))
77 77
         {
78 78
             $this->sRequestedMethod = $_POST['jxnmthd'];
79 79
         }
@@ -100,39 +100,39 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function register($sType, $sClassName, $aOptions)
102 102
     {
103
-        if($sType != $this->getName())
103
+        if ($sType != $this->getName())
104 104
         {
105 105
             return false;
106 106
         }
107 107
 
108
-        if(!is_string($sClassName) || !class_exists($sClassName))
108
+        if (!is_string($sClassName) || !class_exists($sClassName))
109 109
         {
110 110
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
111 111
         }
112 112
         $sClassName = trim($sClassName, '\\');
113 113
         $this->aCallableClasses[] = $sClassName;
114 114
 
115
-        if(!is_array($aOptions))
115
+        if (!is_array($aOptions))
116 116
         {
117 117
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
118 118
         }
119 119
 
120 120
         // Save the classpath and the separator in this class
121
-        if(key_exists('*', $aOptions) && is_array($aOptions['*']))
121
+        if (key_exists('*', $aOptions) && is_array($aOptions['*']))
122 122
         {
123 123
             $_aOptions = $aOptions['*'];
124 124
             $sSeparator = '.';
125
-            if(key_exists('separator', $_aOptions))
125
+            if (key_exists('separator', $_aOptions))
126 126
             {
127 127
                 $sSeparator = trim($_aOptions['separator']);
128 128
             }
129
-            if(!in_array($sSeparator, ['.', '_']))
129
+            if (!in_array($sSeparator, ['.', '_']))
130 130
             {
131 131
                 $sSeparator = '.';
132 132
             }
133 133
             $_aOptions['separator'] = $sSeparator;
134 134
 
135
-            if(array_key_exists('classpath', $_aOptions))
135
+            if (array_key_exists('classpath', $_aOptions))
136 136
             {
137 137
                 $_aOptions['classpath'] = trim($_aOptions['classpath'], ' \\._');
138 138
                 // Save classpath with "\" in the parameters
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
         }
144 144
 
145 145
         // Register the callable object
146
-        jaxon()->di()->set($sClassName, function () use ($sClassName, $aOptions) {
146
+        jaxon()->di()->set($sClassName, function() use ($sClassName, $aOptions) {
147 147
             $xCallableObject = new \Jaxon\Request\Support\CallableObject($sClassName);
148 148
 
149
-            foreach($aOptions as $sMethod => $aValue)
149
+            foreach ($aOptions as $sMethod => $aValue)
150 150
             {
151
-                foreach($aValue as $sName => $sValue)
151
+                foreach ($aValue as $sName => $sValue)
152 152
                 {
153 153
                     $xCallableObject->configure($sMethod, $sName, $sValue);
154 154
                 }
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
         });
159 159
 
160 160
         // Register the request factory for this callable object
161
-        jaxon()->di()->set($sClassName . '\Factory\Rq', function ($di) use ($sClassName) {
161
+        jaxon()->di()->set($sClassName . '\Factory\Rq', function($di) use ($sClassName) {
162 162
             $xCallableObject = $di->get($sClassName);
163 163
             return new \Jaxon\Factory\Request\Portable($xCallableObject);
164 164
         });
165 165
 
166 166
         // Register the paginator factory for this callable object
167
-        jaxon()->di()->set($sClassName . '\Factory\Pg', function ($di) use ($sClassName) {
167
+        jaxon()->di()->set($sClassName . '\Factory\Pg', function($di) use ($sClassName) {
168 168
             $xCallableObject = $di->get($sClassName);
169 169
             return new \Jaxon\Factory\Request\Paginator($xCallableObject);
170 170
         });
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         $di = jaxon()->di();
183 183
         $sHash = '';
184
-        foreach($this->aCallableClasses as $sName)
184
+        foreach ($this->aCallableClasses as $sName)
185 185
         {
186 186
             $xCallableObject = $di->get($sName);
187 187
             $sHash .= $sName . implode('|', $xCallableObject->getMethods());
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
         // Generate code for javascript objects declaration
202 202
         $sJaxonPrefix = $this->getOption('core.prefix.class');
203 203
         $classes = [];
204
-        foreach($this->aClassPaths as $sClassPath)
204
+        foreach ($this->aClassPaths as $sClassPath)
205 205
         {
206 206
             $offset = 0;
207 207
             $sClassPath .= '.Null'; // This is a sentinel. The last token is not processed in the while loop.
208
-            while(($dotPosition = strpos($sClassPath, '.', $offset)) !== false)
208
+            while (($dotPosition = strpos($sClassPath, '.', $offset)) !== false)
209 209
             {
210 210
                 $class = substr($sClassPath, 0, $dotPosition);
211 211
                 // Generate code for this object
212
-                if(!key_exists($class, $classes))
212
+                if (!key_exists($class, $classes))
213 213
                 {
214 214
                     $code .= "$sJaxonPrefix$class = {};\n";
215 215
                     $classes[$class] = $class;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
         // Generate code for javascript methods
222 222
         $di = jaxon()->di();
223
-        foreach($this->aCallableClasses as $sName)
223
+        foreach ($this->aCallableClasses as $sName)
224 224
         {
225 225
             $xCallableObject = $di->get($sName);
226 226
             $code .= $xCallableObject->getScript();
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
     public function canProcessRequest()
237 237
     {
238 238
         // Check the validity of the class name
239
-        if(($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass))
239
+        if (($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass))
240 240
         {
241 241
             $this->sRequestedClass = null;
242 242
             $this->sRequestedMethod = null;
243 243
         }
244 244
         // Check the validity of the method name
245
-        if(($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod))
245
+        if (($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod))
246 246
         {
247 247
             $this->sRequestedClass = null;
248 248
             $this->sRequestedMethod = null;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      */
258 258
     public function processRequest()
259 259
     {
260
-        if(!$this->canProcessRequest())
260
+        if (!$this->canProcessRequest())
261 261
         {
262 262
             return false;
263 263
         }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
         // Find the requested method
268 268
         $xCallableObject = $this->getCallableObject($this->sRequestedClass);
269
-        if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
269
+        if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
270 270
         {
271 271
             // Unable to find the requested object or method
272 272
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid',
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         // at the beginning and the end of the class name.
292 292
         $sClassName = trim(str_replace(['.', '_'], ['\\', '\\'], (string)$sClassName), '\\');
293 293
         // Register an instance of the requested class, if it isn't yet
294
-        if(!key_exists($sClassName, $this->aCallableClasses))
294
+        if (!key_exists($sClassName, $this->aCallableClasses))
295 295
         {
296 296
             $this->getPluginManager()->registerClass($sClassName);
297 297
         }
Please login to merge, or discard this patch.
src/Request/Plugin/UserFunction.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function __construct()
49 49
     {
50
-        if(isset($_GET['jxnfun']))
50
+        if (isset($_GET['jxnfun']))
51 51
         {
52 52
             $this->sRequestedFunction = $_GET['jxnfun'];
53 53
         }
54
-        if(isset($_POST['jxnfun']))
54
+        if (isset($_POST['jxnfun']))
55 55
         {
56 56
             $this->sRequestedFunction = $_POST['jxnfun'];
57 57
         }
@@ -78,30 +78,30 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function register($sType, $sUserFunction, $aOptions)
80 80
     {
81
-        if($sType != $this->getName())
81
+        if ($sType != $this->getName())
82 82
         {
83 83
             return false;
84 84
         }
85 85
 
86
-        if(!is_string($sUserFunction))
86
+        if (!is_string($sUserFunction))
87 87
         {
88 88
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
89 89
         }
90 90
 
91
-        if(is_string($aOptions))
91
+        if (is_string($aOptions))
92 92
         {
93 93
             $aOptions = ['include' => $aOptions];
94 94
         }
95
-        if(!is_array($aOptions))
95
+        if (!is_array($aOptions))
96 96
         {
97 97
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
98 98
         }
99 99
 
100 100
         // Check if an alias is defined
101 101
         $sFunctionName = $sUserFunction;
102
-        foreach($aOptions as $sName => $sValue)
102
+        foreach ($aOptions as $sName => $sValue)
103 103
         {
104
-            if($sName == 'alias')
104
+            if ($sName == 'alias')
105 105
             {
106 106
                 $sFunctionName = $sValue;
107 107
                 break;
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
         }
110 110
 
111 111
         $this->aFunctions[$sFunctionName] = $sUserFunction;
112
-        jaxon()->di()->set($sFunctionName, function () use ($sUserFunction, $aOptions) {
112
+        jaxon()->di()->set($sFunctionName, function() use ($sUserFunction, $aOptions) {
113 113
             $xUserFunction = new \Jaxon\Request\Support\UserFunction($sUserFunction);
114 114
 
115
-            foreach($aOptions as $sName => $sValue)
115
+            foreach ($aOptions as $sName => $sValue)
116 116
             {
117 117
                 $xUserFunction->configure($sName, $sValue);
118 118
             }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $di = jaxon()->di();
144 144
         $code = '';
145
-        foreach($this->aFunctions as $sName)
145
+        foreach ($this->aFunctions as $sName)
146 146
         {
147 147
             $xFunction = $di->get($sName);
148 148
             $code .= $xFunction->getScript();
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     public function canProcessRequest()
159 159
     {
160 160
         // Check the validity of the function name
161
-        if(($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
161
+        if (($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
162 162
         {
163 163
             $this->sRequestedFunction = null;
164 164
         }
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function processRequest()
174 174
     {
175
-        if(!$this->canProcessRequest())
175
+        if (!$this->canProcessRequest())
176 176
         {
177 177
             return false;
178 178
         }
179 179
 
180
-        if(!key_exists($this->sRequestedFunction, $this->aFunctions))
180
+        if (!key_exists($this->sRequestedFunction, $this->aFunctions))
181 181
         {
182 182
             // Unable to find the requested function
183 183
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid',
Please login to merge, or discard this patch.
src/Request/Plugin/FileUpload.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $this->sUploadSubdir = uniqid() . DIRECTORY_SEPARATOR;
60 60
 
61
-        if(array_key_exists('jxnupl', $_POST))
61
+        if (array_key_exists('jxnupl', $_POST))
62 62
         {
63 63
             $this->sTempFile = $_POST['jxnupl'];
64 64
         }
65
-        elseif(array_key_exists('jxnupl', $_GET))
65
+        elseif (array_key_exists('jxnupl', $_GET))
66 66
         {
67 67
             $this->sTempFile = $_GET['jxnupl'];
68 68
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     protected function filterFilename($sFilename, $sVarName)
92 92
     {
93
-        if(($this->fFileFilter))
93
+        if (($this->fFileFilter))
94 94
         {
95 95
             $fFileFilter = $this->fFileFilter;
96 96
             $sFilename = (string)$fFileFilter($sFilename, $sVarName);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $sUploadDir = $this->getOption('upload.files.' . $sFieldId . '.dir', $sDefaultUploadDir);
113 113
         $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
114 114
         // Verify that the upload dir exists and is writable
115
-        if(!is_writable($sUploadDir))
115
+        if (!is_writable($sUploadDir))
116 116
         {
117 117
             throw new \Jaxon\Exception\Error($this->trans('errors.upload.access'));
118 118
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $sUploadDir = $this->getOption('upload.default.dir');
133 133
         $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
134 134
         // Verify that the upload dir exists and is writable
135
-        if(!is_writable($sUploadDir))
135
+        if (!is_writable($sUploadDir))
136 136
         {
137 137
             throw new \Jaxon\Exception\Error($this->trans('errors.upload.access'));
138 138
         }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
153 153
         $sUploadDir .= 'tmp' . DIRECTORY_SEPARATOR;
154 154
         $sUploadTempFile = $sUploadDir . $this->sTempFile . '.json';
155
-        if(!is_readable($sUploadTempFile))
155
+        if (!is_readable($sUploadTempFile))
156 156
         {
157 157
             throw new \Jaxon\Exception\Error($this->trans('errors.upload.access'));
158 158
         }
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
     {
169 169
         // Check validity of the uploaded files
170 170
         $aTempFiles = [];
171
-        foreach($_FILES as $sVarName => $aFile)
171
+        foreach ($_FILES as $sVarName => $aFile)
172 172
         {
173
-            if(is_array($aFile['name']))
173
+            if (is_array($aFile['name']))
174 174
             {
175
-                for($i = 0; $i < count($aFile['name']); $i++)
175
+                for ($i = 0; $i < count($aFile['name']); $i++)
176 176
                 {
177
-                    if(!$aFile['name'][$i])
177
+                    if (!$aFile['name'][$i])
178 178
                     {
179 179
                         continue;
180 180
                     }
181
-                    if(!array_key_exists($sVarName, $aTempFiles))
181
+                    if (!array_key_exists($sVarName, $aTempFiles))
182 182
                     {
183 183
                         $aTempFiles[$sVarName] = [];
184 184
                     }
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
             }
199 199
             else
200 200
             {
201
-                if(!$aFile['name'])
201
+                if (!$aFile['name'])
202 202
                 {
203 203
                     continue;
204 204
                 }
205
-                if(!array_key_exists($sVarName, $aTempFiles))
205
+                if (!array_key_exists($sVarName, $aTempFiles))
206 206
                 {
207 207
                     $aTempFiles[$sVarName] = [];
208 208
                 }
@@ -222,17 +222,17 @@  discard block
 block discarded – undo
222 222
         }
223 223
 
224 224
         // Check uploaded files validity
225
-        foreach($aTempFiles as $sVarName => $aFiles)
225
+        foreach ($aTempFiles as $sVarName => $aFiles)
226 226
         {
227
-            foreach($aFiles as $aFile)
227
+            foreach ($aFiles as $aFile)
228 228
             {
229 229
                 // Verify upload result
230
-                if($aFile['error'] != 0)
230
+                if ($aFile['error'] != 0)
231 231
                 {
232 232
                     throw new \Jaxon\Exception\Error($this->trans('errors.upload.failed', $aFile));
233 233
                 }
234 234
                 // Verify file validity (format, size)
235
-                if(!$this->validateUploadedFile($sVarName, $aFile))
235
+                if (!$this->validateUploadedFile($sVarName, $aFile))
236 236
                 {
237 237
                     throw new \Jaxon\Exception\Error($this->getValidatorMessage());
238 238
                 }
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
         }
243 243
 
244 244
         // Copy the uploaded files from the temp dir to the user dir
245
-        foreach($aTempFiles as $sVarName => $aTempFiles)
245
+        foreach ($aTempFiles as $sVarName => $aTempFiles)
246 246
         {
247 247
             $this->aUserFiles[$sVarName] = [];
248
-            foreach($aTempFiles as $aFile)
248
+            foreach ($aTempFiles as $aFile)
249 249
             {
250 250
                 // Get the path to the upload dir
251 251
                 $sUploadDir = $this->getUploadDir($sVarName);
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
     {
268 268
         // Convert uploaded file to an array
269 269
         $aFiles = [];
270
-        foreach($this->aUserFiles as $sVarName => $aUserFiles)
270
+        foreach ($this->aUserFiles as $sVarName => $aUserFiles)
271 271
         {
272 272
             $aFiles[$sVarName] = [];
273
-            foreach($aUserFiles as $aUserFile)
273
+            foreach ($aUserFiles as $aUserFile)
274 274
             {
275 275
                  $aFiles[$sVarName][] = $aUserFile->toTempData();
276 276
             }
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
         // Upload temp file
292 292
         $sUploadTempFile = $this->getUploadTempFile();
293 293
         $aFiles = json_decode(file_get_contents($sUploadTempFile), true);
294
-        foreach($aFiles as $sVarName => $aUserFiles)
294
+        foreach ($aFiles as $sVarName => $aUserFiles)
295 295
         {
296 296
             $this->aUserFiles[$sVarName] = [];
297
-            foreach($aUserFiles as $aUserFile)
297
+            foreach ($aUserFiles as $aUserFile)
298 298
             {
299 299
                 $this->aUserFiles[$sVarName][] = UploadedFile::fromTempData($aUserFile);
300 300
             }
@@ -359,15 +359,15 @@  discard block
 block discarded – undo
359 359
      */
360 360
     public function processRequest()
361 361
     {
362
-        if(!$this->canProcessRequest())
362
+        if (!$this->canProcessRequest())
363 363
         {
364 364
             return false;
365 365
         }
366
-        if(count($_FILES) > 0)
366
+        if (count($_FILES) > 0)
367 367
         {
368 368
             $this->readFromHttpData();
369 369
         }
370
-        elseif(($this->sTempFile))
370
+        elseif (($this->sTempFile))
371 371
         {
372 372
             $this->readFromTempFile();
373 373
         }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     public function saveUploadedFiles()
383 383
     {
384 384
         // Process uploaded files
385
-        if(!$this->processRequest())
385
+        if (!$this->processRequest())
386 386
         {
387 387
             return '';
388 388
         }
Please login to merge, or discard this patch.