Passed
Push — main ( 273db0...683317 )
by Thierry
03:54
created
jaxon-upload/src/register.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 {
25 25
     $jaxon = jaxon();
26 26
     $di = $jaxon->di();
27
-    if($di->h(UploadHandler::class))
27
+    if ($di->h(UploadHandler::class))
28 28
     {
29 29
         return;
30 30
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $xUploadHandler = $di->g(UploadHandler::class);
77 77
         // The HTTP request
78 78
         $xRequest = $di->getRequest();
79
-        if($xUploadHandler->canProcessRequest($xRequest))
79
+        if ($xUploadHandler->canProcessRequest($xRequest))
80 80
         {
81 81
             $xUploadHandler->processRequest($xRequest);
82 82
         }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 {
93 93
     $jaxon = jaxon();
94 94
     $jaxon->callback()->boot(function() use($jaxon) {
95
-        if($jaxon->getOption('core.upload.enabled'))
95
+        if ($jaxon->getOption('core.upload.enabled'))
96 96
         {
97 97
             registerUpload();
98 98
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 function register()
103 103
 {
104 104
     // Do nothing if running in cli.
105
-    if(php_sapi_name() !== 'cli')
105
+    if (php_sapi_name() !== 'cli')
106 106
     {
107 107
         _register();
108 108
     };
Please login to merge, or discard this patch.
Switch Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -22,63 +22,63 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function registerUpload(): void
24 24
 {
25
-    $jaxon = jaxon();
26
-    $di = $jaxon->di();
27
-    if($di->h(UploadHandler::class))
28
-    {
29
-        return;
30
-    }
25
+$jaxon = jaxon();
26
+$di = $jaxon->di();
27
+if($di->h(UploadHandler::class))
28
+{
29
+return;
30
+}
31 31
 
32
-    // Upload file and dir name generator
33
-    $di->set(FileNameInterface::class, function() {
34
-        return new class implements FileNameInterface
35
-        {
36
-            public function random(int $nLength): string
37
-            {
38
-                return bin2hex(random_bytes((int)($nLength / 2)));
39
-            }
40
-        };
41
-    });
42
-    // Upload validator
43
-    $di->set(Validator::class, function($c) {
44
-        return new Validator($c->g(ConfigManager::class), $c->g(Translator::class));
45
-    });
46
-    // File storage
47
-    $di->set(FileStorage::class, function($c) {
48
-        return  new FileStorage($c->g(ConfigManager::class), $c->g(Translator::class));
49
-    });
50
-    // File upload manager
51
-    $di->set(UploadManager::class, function($c) {
52
-        // Translation directory
53
-        $sTranslationDir = dirname(__DIR__) . '/translations';
54
-        // Load the upload translations
55
-        $xTranslator = $c->g(Translator::class);
56
-        $xTranslator->loadTranslations("$sTranslationDir/en/upload.php", 'en');
57
-        $xTranslator->loadTranslations("$sTranslationDir/fr/upload.php", 'fr');
58
-        $xTranslator->loadTranslations("$sTranslationDir/es/upload.php", 'es');
32
+// Upload file and dir name generator
33
+$di->set(FileNameInterface::class, function() {
34
+return new class implements FileNameInterface
35
+{
36
+public function random(int $nLength): string
37
+{
38
+    return bin2hex(random_bytes((int)($nLength / 2)));
39
+}
40
+};
41
+});
42
+// Upload validator
43
+$di->set(Validator::class, function($c) {
44
+return new Validator($c->g(ConfigManager::class), $c->g(Translator::class));
45
+});
46
+// File storage
47
+$di->set(FileStorage::class, function($c) {
48
+return  new FileStorage($c->g(ConfigManager::class), $c->g(Translator::class));
49
+});
50
+// File upload manager
51
+$di->set(UploadManager::class, function($c) {
52
+// Translation directory
53
+$sTranslationDir = dirname(__DIR__) . '/translations';
54
+// Load the upload translations
55
+$xTranslator = $c->g(Translator::class);
56
+$xTranslator->loadTranslations("$sTranslationDir/en/upload.php", 'en');
57
+$xTranslator->loadTranslations("$sTranslationDir/fr/upload.php", 'fr');
58
+$xTranslator->loadTranslations("$sTranslationDir/es/upload.php", 'es');
59 59
 
60
-        return new UploadManager($c->g(LoggerInterface::class), $c->g(Validator::class),
61
-            $xTranslator, $c->g(FileStorage::class),
62
-            $c->g(FileNameInterface::class));
63
-    });
64
-    // File upload plugin
65
-    $di->set(UploadHandler::class, function($c) {
66
-        return new UploadHandler($c->g(FileStorage::class), $c->g(UploadManager::class));
67
-    });
68
-    // Set alias on the interface
69
-    $di->alias(UploadHandlerInterface::class, UploadHandler::class);
60
+return new UploadManager($c->g(LoggerInterface::class), $c->g(Validator::class),
61
+$xTranslator, $c->g(FileStorage::class),
62
+$c->g(FileNameInterface::class));
63
+});
64
+// File upload plugin
65
+$di->set(UploadHandler::class, function($c) {
66
+return new UploadHandler($c->g(FileStorage::class), $c->g(UploadManager::class));
67
+});
68
+// Set alias on the interface
69
+$di->alias(UploadHandlerInterface::class, UploadHandler::class);
70 70
 
71
-    // Set a callback to process uploaded files in the incoming requests.
72
-    $jaxon->callback()->before(function() use($di) {
73
-        /** @var UploadHandler */
74
-        $xUploadHandler = $di->g(UploadHandler::class);
75
-        // The HTTP request
76
-        $xRequest = $di->getRequest();
77
-        if($xUploadHandler->canProcessRequest($xRequest))
78
-        {
79
-            $xUploadHandler->processRequest($xRequest);
80
-        }
81
-    });
71
+// Set a callback to process uploaded files in the incoming requests.
72
+$jaxon->callback()->before(function() use($di) {
73
+/** @var UploadHandler */
74
+$xUploadHandler = $di->g(UploadHandler::class);
75
+// The HTTP request
76
+$xRequest = $di->getRequest();
77
+if($xUploadHandler->canProcessRequest($xRequest))
78
+{
79
+$xUploadHandler->processRequest($xRequest);
80
+}
81
+});
82 82
 }
83 83
 
84 84
 /**
@@ -88,22 +88,22 @@  discard block
 block discarded – undo
88 88
  */
89 89
 function _register(): void
90 90
 {
91
-    $jaxon = jaxon();
92
-    $jaxon->callback()->boot(function() use($jaxon) {
93
-        if($jaxon->getOption('core.upload.enabled'))
94
-        {
95
-            registerUpload();
96
-        }
97
-    });
91
+$jaxon = jaxon();
92
+$jaxon->callback()->boot(function() use($jaxon) {
93
+if($jaxon->getOption('core.upload.enabled'))
94
+{
95
+registerUpload();
96
+}
97
+});
98 98
 }
99 99
 
100 100
 function register()
101 101
 {
102
-    // Do nothing if running in cli.
103
-    if(php_sapi_name() !== 'cli')
104
-    {
105
-        _register();
106
-    };
102
+// Do nothing if running in cli.
103
+if(php_sapi_name() !== 'cli')
104
+{
105
+_register();
106
+};
107 107
 }
108 108
 
109 109
 register();
Please login to merge, or discard this patch.
jaxon-upload/src/Manager/Validator.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty);
99 99
         $aAllowed = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
100
-        if(is_array($aAllowed) && !in_array($sValue, $aAllowed))
100
+        if (is_array($aAllowed) && !in_array($sValue, $aAllowed))
101 101
         {
102 102
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sField, [$sField => $sValue]);
103 103
             return false;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty, 0);
120 120
         $nSize = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
121
-        if($nSize > 0 && (
121
+        if ($nSize > 0 && (
122 122
             ($sProperty == 'max-size' && $nFileSize > $nSize) ||
123 123
             ($sProperty == 'min-size' && $nFileSize < $nSize)))
124 124
         {
@@ -140,25 +140,25 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $this->sErrorMessage = '';
142 142
         // Verify the file extension
143
-        if(!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type'))
143
+        if (!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type'))
144 144
         {
145 145
             return false;
146 146
         }
147 147
 
148 148
         // Verify the file extension
149
-        if(!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension'))
149
+        if (!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension'))
150 150
         {
151 151
             return false;
152 152
         }
153 153
 
154 154
         // Verify the max size
155
-        if(!$this->validateFileSize($sVarName, $xFile->size(), 'max-size'))
155
+        if (!$this->validateFileSize($sVarName, $xFile->size(), 'max-size'))
156 156
         {
157 157
             return false;
158 158
         }
159 159
 
160 160
         // Verify the min size
161
-        if(!$this->validateFileSize($sVarName, $xFile->size(), 'min-size'))
161
+        if (!$this->validateFileSize($sVarName, $xFile->size(), 'min-size'))
162 162
         {
163 163
             return false;
164 164
         }
Please login to merge, or discard this patch.
Switch Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -30,46 +30,46 @@  discard block
 block discarded – undo
30 30
 
31 31
 class Validator
32 32
 {
33
-    /**
33
+/**
34 34
      * The config manager
35 35
      *
36 36
      * @var ConfigManager
37 37
      */
38
-    protected $xConfigManager;
38
+protected $xConfigManager;
39 39
 
40
-    /**
40
+/**
41 41
      * The translator
42 42
      *
43 43
      * @var Translator
44 44
      */
45
-    protected $xTranslator;
45
+protected $xTranslator;
46 46
 
47
-    /**
47
+/**
48 48
      * The last error message
49 49
      *
50 50
      * @var string
51 51
      */
52
-    protected $sErrorMessage;
52
+protected $sErrorMessage;
53 53
 
54
-    public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
55
-    {
56
-        // Set the config manager
57
-        $this->xConfigManager = $xConfigManager;
58
-        // Set the translator
59
-        $this->xTranslator = $xTranslator;
60
-    }
54
+public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
55
+{
56
+// Set the config manager
57
+$this->xConfigManager = $xConfigManager;
58
+// Set the translator
59
+$this->xTranslator = $xTranslator;
60
+}
61 61
 
62
-    /**
62
+/**
63 63
      * Get the last error message
64 64
      *
65 65
      * @return string
66 66
      */
67
-    public function getErrorMessage(): string
68
-    {
69
-        return $this->sErrorMessage;
70
-    }
67
+public function getErrorMessage(): string
68
+{
69
+return $this->sErrorMessage;
70
+}
71 71
 
72
-    /**
72
+/**
73 73
      * Validate a property of an uploaded file
74 74
      *
75 75
      * @param string $sVarName    The uploaded file variable name
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @return bool
81 81
      */
82
-    private function validateFileProperty(string $sVarName, string $sValue, string $sProperty, string $sField): bool
83
-    {
84
-        $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty);
85
-        $aAllowed = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
86
-        if(is_array($aAllowed) && !in_array($sValue, $aAllowed))
87
-        {
88
-            $this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sField, [$sField => $sValue]);
89
-            return false;
90
-        }
91
-        return true;
92
-    }
93
-
94
-    /**
82
+private function validateFileProperty(string $sVarName, string $sValue, string $sProperty, string $sField): bool
83
+{
84
+$xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty);
85
+$aAllowed = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
86
+if(is_array($aAllowed) && !in_array($sValue, $aAllowed))
87
+{
88
+$this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sField, [$sField => $sValue]);
89
+return false;
90
+}
91
+return true;
92
+}
93
+
94
+/**
95 95
      * Validate the size of an uploaded file
96 96
      *
97 97
      * @param string $sVarName    The uploaded file variable name
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @return bool
102 102
      */
103
-    private function validateFileSize(string $sVarName, int $nFileSize, string $sProperty): bool
104
-    {
105
-        $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty, 0);
106
-        $nSize = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
107
-        if($nSize > 0 && (
108
-            ($sProperty == 'max-size' && $nFileSize > $nSize) ||
109
-            ($sProperty == 'min-size' && $nFileSize < $nSize)))
110
-        {
111
-            $this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sProperty, ['size' => $nFileSize]);
112
-            return false;
113
-        }
114
-        return true;
115
-    }
116
-
117
-    /**
103
+private function validateFileSize(string $sVarName, int $nFileSize, string $sProperty): bool
104
+{
105
+$xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty, 0);
106
+$nSize = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
107
+if($nSize > 0 && (
108
+($sProperty == 'max-size' && $nFileSize > $nSize) ||
109
+($sProperty == 'min-size' && $nFileSize < $nSize)))
110
+{
111
+$this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sProperty, ['size' => $nFileSize]);
112
+return false;
113
+}
114
+return true;
115
+}
116
+
117
+/**
118 118
      * Validate an uploaded file
119 119
      *
120 120
      * @param string $sVarName    The uploaded file variable name
@@ -122,33 +122,33 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return bool
124 124
      */
125
-    public function validateUploadedFile(string $sVarName, File $xFile): bool
126
-    {
127
-        $this->sErrorMessage = '';
128
-        // Verify the file extension
129
-        if(!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type'))
130
-        {
131
-            return false;
132
-        }
133
-
134
-        // Verify the file extension
135
-        if(!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension'))
136
-        {
137
-            return false;
138
-        }
139
-
140
-        // Verify the max size
141
-        if(!$this->validateFileSize($sVarName, $xFile->size(), 'max-size'))
142
-        {
143
-            return false;
144
-        }
145
-
146
-        // Verify the min size
147
-        if(!$this->validateFileSize($sVarName, $xFile->size(), 'min-size'))
148
-        {
149
-            return false;
150
-        }
151
-
152
-        return true;
153
-    }
125
+public function validateUploadedFile(string $sVarName, File $xFile): bool
126
+{
127
+$this->sErrorMessage = '';
128
+// Verify the file extension
129
+if(!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type'))
130
+{
131
+return false;
132
+}
133
+
134
+// Verify the file extension
135
+if(!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension'))
136
+{
137
+return false;
138
+}
139
+
140
+// Verify the max size
141
+if(!$this->validateFileSize($sVarName, $xFile->size(), 'max-size'))
142
+{
143
+return false;
144
+}
145
+
146
+// Verify the min size
147
+if(!$this->validateFileSize($sVarName, $xFile->size(), 'min-size'))
148
+{
149
+return false;
150
+}
151
+
152
+return true;
153
+}
154 154
 }
Please login to merge, or discard this patch.
jaxon-upload/src/Manager/File.php 1 patch
Switch Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -22,56 +22,56 @@  discard block
 block discarded – undo
22 22
 
23 23
 class File implements FileInterface
24 24
 {
25
-    /**
25
+/**
26 26
      * The uploaded file type
27 27
      *
28 28
      * @var string
29 29
      */
30
-    protected $sType;
30
+protected $sType;
31 31
 
32
-    /**
32
+/**
33 33
      * The uploaded file name, without the extension and sanitized
34 34
      *
35 35
      * @var string
36 36
      */
37
-    protected $sName;
37
+protected $sName;
38 38
 
39
-    /**
39
+/**
40 40
      * The uploaded file name, with the extension
41 41
      *
42 42
      * @var string
43 43
      */
44
-    protected $sFilename;
44
+protected $sFilename;
45 45
 
46
-    /**
46
+/**
47 47
      * The uploaded file path
48 48
      *
49 49
      * @var string
50 50
      */
51
-    protected $sPath;
51
+protected $sPath;
52 52
 
53
-    /**
53
+/**
54 54
      * The uploaded file size
55 55
      *
56 56
      * @var int
57 57
      */
58
-    protected $nSize;
58
+protected $nSize;
59 59
 
60
-    /**
60
+/**
61 61
      * The uploaded file extension
62 62
      *
63 63
      * @var string
64 64
      */
65
-    protected $sExtension;
65
+protected $sExtension;
66 66
 
67
-    /**
67
+/**
68 68
      * The filesystem where the file is stored
69 69
      *
70 70
      * @var Filesystem
71 71
      */
72
-    protected $xFilesystem;
72
+protected $xFilesystem;
73 73
 
74
-    /**
74
+/**
75 75
      * Create an instance of this class using data from an uploaded file.
76 76
      *
77 77
      * @param Filesystem $xFilesystem
@@ -81,87 +81,87 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return File
83 83
      */
84
-    public static function fromHttpFile(Filesystem $xFilesystem,
85
-        UploadedFile $xHttpFile, string $sUploadDir, string $sName): File
86
-    {
87
-        $xFile = new File();
88
-        $xFile->xFilesystem = $xFilesystem;
89
-        $xFile->sType = $xHttpFile->getClientMediaType();
90
-        $xFile->sName = $sName;
91
-        $xFile->sFilename = $xHttpFile->getClientFilename();
92
-        $xFile->sExtension = pathinfo($xFile->sFilename, PATHINFO_EXTENSION);
93
-        $xFile->nSize = $xHttpFile->getSize();
94
-        $xFile->sPath = $sUploadDir . $xFile->sName . '.' . $xFile->sExtension;
95
-        return $xFile;
96
-    }
97
-
98
-    /**
84
+public static function fromHttpFile(Filesystem $xFilesystem,
85
+UploadedFile $xHttpFile, string $sUploadDir, string $sName): File
86
+{
87
+$xFile = new File();
88
+$xFile->xFilesystem = $xFilesystem;
89
+$xFile->sType = $xHttpFile->getClientMediaType();
90
+$xFile->sName = $sName;
91
+$xFile->sFilename = $xHttpFile->getClientFilename();
92
+$xFile->sExtension = pathinfo($xFile->sFilename, PATHINFO_EXTENSION);
93
+$xFile->nSize = $xHttpFile->getSize();
94
+$xFile->sPath = $sUploadDir . $xFile->sName . '.' . $xFile->sExtension;
95
+return $xFile;
96
+}
97
+
98
+/**
99 99
      * Get the filesystem where the file is stored
100 100
      *
101 101
      * @return Filesystem
102 102
      */
103
-    public function filesystem(): Filesystem
104
-    {
105
-        return $this->xFilesystem;
106
-    }
103
+public function filesystem(): Filesystem
104
+{
105
+return $this->xFilesystem;
106
+}
107 107
 
108
-    /**
108
+/**
109 109
      * Get the uploaded file type
110 110
      *
111 111
      * @return string
112 112
      */
113
-    public function type(): string
114
-    {
115
-        return $this->sType;
116
-    }
113
+public function type(): string
114
+{
115
+return $this->sType;
116
+}
117 117
 
118
-    /**
118
+/**
119 119
      * Get the uploaded file name, without the extension and slugified
120 120
      *
121 121
      * @return string
122 122
      */
123
-    public function name(): string
124
-    {
125
-        return $this->sName;
126
-    }
123
+public function name(): string
124
+{
125
+return $this->sName;
126
+}
127 127
 
128
-    /**
128
+/**
129 129
      * Get the uploaded file name, with the extension
130 130
      *
131 131
      * @return string
132 132
      */
133
-    public function filename(): string
134
-    {
135
-        return $this->sFilename;
136
-    }
133
+public function filename(): string
134
+{
135
+return $this->sFilename;
136
+}
137 137
 
138
-    /**
138
+/**
139 139
      * Get the uploaded file path
140 140
      *
141 141
      * @return string
142 142
      */
143
-    public function path(): string
144
-    {
145
-        return $this->sPath;
146
-    }
143
+public function path(): string
144
+{
145
+return $this->sPath;
146
+}
147 147
 
148
-    /**
148
+/**
149 149
      * Get the uploaded file size
150 150
      *
151 151
      * @return int
152 152
      */
153
-    public function size(): int
154
-    {
155
-        return $this->nSize;
156
-    }
153
+public function size(): int
154
+{
155
+return $this->nSize;
156
+}
157 157
 
158
-    /**
158
+/**
159 159
      * Get the uploaded file extension
160 160
      *
161 161
      * @return string
162 162
      */
163
-    public function extension(): string
164
-    {
165
-        return $this->sExtension;
166
-    }
163
+public function extension(): string
164
+{
165
+return $this->sExtension;
166
+}
167 167
 }
Please login to merge, or discard this patch.
jaxon-upload/src/Manager/FileNameInterface.php 1 patch
Switch Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,12 +4,12 @@
 block discarded – undo
4 4
 
5 5
 interface FileNameInterface
6 6
 {
7
-    /**
7
+/**
8 8
      * Generate a random name for a file or dir
9 9
      *
10 10
      * @param int $nLength
11 11
      *
12 12
      * @return string
13 13
      */
14
-    public function random(int $nLength): string;
14
+public function random(int $nLength): string;
15 15
 }
Please login to merge, or discard this patch.
jaxon-upload/src/UploadHandler.php 1 patch
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -25,58 +25,58 @@  discard block
 block discarded – undo
25 25
 
26 26
 class UploadHandler implements UploadHandlerInterface
27 27
 {
28
-    /**
28
+/**
29 29
      * The uploaded files copied in the user dir
30 30
      *
31 31
      * @var array
32 32
      */
33
-    private $aUserFiles = [];
33
+private $aUserFiles = [];
34 34
 
35
-    /**
35
+/**
36 36
      * The constructor
37 37
      *
38 38
      * @param FileStorage $xFileStorage
39 39
      * @param UploadManager $xUploadManager
40 40
      */
41
-    public function __construct(private FileStorage $xFileStorage,
42
-        private UploadManager $xUploadManager)
43
-    {}
41
+public function __construct(private FileStorage $xFileStorage,
42
+private UploadManager $xUploadManager)
43
+{}
44 44
 
45
-    /**
45
+/**
46 46
      * Set the uploaded file name sanitizer
47 47
      *
48 48
      * @param Closure $cSanitizer    The closure
49 49
      *
50 50
      * @return void
51 51
      */
52
-    public function sanitizer(Closure $cSanitizer): void
53
-    {
54
-        $this->xUploadManager->setNameSanitizer($cSanitizer);
55
-    }
52
+public function sanitizer(Closure $cSanitizer): void
53
+{
54
+$this->xUploadManager->setNameSanitizer($cSanitizer);
55
+}
56 56
 
57
-    /**
57
+/**
58 58
      * Get the uploaded files
59 59
      *
60 60
      * @return array
61 61
      */
62
-    public function files(): array
63
-    {
64
-        return $this->aUserFiles;
65
-    }
62
+public function files(): array
63
+{
64
+return $this->aUserFiles;
65
+}
66 66
 
67
-    /**
67
+/**
68 68
      * Check if the current request contains uploaded files
69 69
      *
70 70
      * @param ServerRequestInterface $xRequest
71 71
      *
72 72
      * @return bool
73 73
      */
74
-    public function canProcessRequest(ServerRequestInterface $xRequest): bool
75
-    {
76
-        return count($xRequest->getUploadedFiles()) > 0;
77
-    }
74
+public function canProcessRequest(ServerRequestInterface $xRequest): bool
75
+{
76
+return count($xRequest->getUploadedFiles()) > 0;
77
+}
78 78
 
79
-    /**
79
+/**
80 80
      * Process the uploaded files in the HTTP request
81 81
      *
82 82
      * @param ServerRequestInterface $xRequest
@@ -84,21 +84,21 @@  discard block
 block discarded – undo
84 84
      * @return bool
85 85
      * @throws RequestException
86 86
      */
87
-    public function processRequest(ServerRequestInterface $xRequest): bool
88
-    {
89
-        // Copy the uploaded files from the HTTP request.
90
-        $this->aUserFiles = $this->xUploadManager->readFromHttpData($xRequest);
91
-        return true;
92
-    }
87
+public function processRequest(ServerRequestInterface $xRequest): bool
88
+{
89
+// Copy the uploaded files from the HTTP request.
90
+$this->aUserFiles = $this->xUploadManager->readFromHttpData($xRequest);
91
+return true;
92
+}
93 93
 
94
-    /**
94
+/**
95 95
      * @param string $sStorage
96 96
      * @param Closure $cFactory
97 97
      *
98 98
      * @return void
99 99
      */
100
-    public function registerStorageAdapter(string $sStorage, Closure $cFactory): void
101
-    {
102
-        $this->xFileStorage->registerAdapter($sStorage, $cFactory);
103
-    }
100
+public function registerStorageAdapter(string $sStorage, Closure $cFactory): void
101
+{
102
+$this->xFileStorage->registerAdapter($sStorage, $cFactory);
103
+}
104 104
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/DatabagData.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
      */
51 51
     protected function validateName(string $sName): void
52 52
     {
53
-        if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0)
53
+        if (preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0)
54 54
         {
55 55
             return;
56 56
         }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/AbstractRequestPlugin.php 1 patch
Switch Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@
 block discarded – undo
30 30
 
31 31
 abstract class AbstractRequestPlugin extends AbstractPlugin implements CallableRegistryInterface, RequestHandlerInterface
32 32
 {
33
-    /**
33
+/**
34 34
      * @var Target
35 35
      */
36
-    protected $xTarget = null;
36
+protected $xTarget = null;
37 37
 
38
-    /**
38
+/**
39 39
      * @inheritDoc
40 40
      */
41
-    public function getTarget(): ?Target
42
-    {
43
-        return $this->xTarget;
44
-    }
41
+public function getTarget(): ?Target
42
+{
43
+return $this->xTarget;
44
+}
45 45
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/RequestHandlerInterface.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@  discard block
 block discarded – undo
7 7
 
8 8
 interface RequestHandlerInterface
9 9
 {
10
-    /**
10
+/**
11 11
      * Get the target function or class and method
12 12
      *
13 13
      * @return Target|null
14 14
      */
15
-    public function getTarget(): ?Target;
15
+public function getTarget(): ?Target;
16 16
 
17
-    /**
17
+/**
18 18
      * @param ServerRequestInterface $xRequest
19 19
      *
20 20
      * @return Target
21 21
      */
22
-    public function setTarget(ServerRequestInterface $xRequest): Target;
22
+public function setTarget(ServerRequestInterface $xRequest): Target;
23 23
 
24
-    /**
24
+/**
25 25
      * Check if this plugin can process the current request
26 26
      *
27 27
      * Called by the <Jaxon\Plugin\RequestManager> when a request has been received to determine
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
      *
32 32
      * @return bool
33 33
      */
34
-    public static function canProcessRequest(ServerRequestInterface $xRequest): bool;
34
+public static function canProcessRequest(ServerRequestInterface $xRequest): bool;
35 35
 
36
-    /**
36
+/**
37 37
      * Process the current request
38 38
      *
39 39
      * Called by the <Jaxon\Plugin\RequestManager> when a request is being processed.
@@ -42,5 +42,5 @@  discard block
 block discarded – undo
42 42
      *
43 43
      * @return void
44 44
      */
45
-    public function processRequest(): void;
45
+public function processRequest(): void;
46 46
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/AttrAnnotationTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $aFiles = scandir($this->sCacheDir);
46 46
         foreach ($aFiles as $sFile)
47 47
         {
48
-            if($sFile !== '.' && $sFile !== '..')
48
+            if ($sFile !== '.' && $sFile !== '..')
49 49
             {
50 50
                 @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
51 51
             }
Please login to merge, or discard this patch.