Passed
Push — develop ( 089cb5...597d05 )
by nguereza
05:42
created
src/Http/RequestData.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
54 54
  * @class RequestData
55 55
  * @package Platine\Framework\Http
56 56
  */
57
-class RequestData
58
-{
57
+class RequestData {
59 58
     /**
60 59
      * The request body or post data
61 60
      * @var array<string, mixed>
@@ -96,8 +95,7 @@  discard block
 block discarded – undo
96 95
      * Create new instance
97 96
      * @param ServerRequestInterface $request
98 97
      */
99
-    public function __construct(ServerRequestInterface $request)
100
-    {
98
+    public function __construct(ServerRequestInterface $request) {
101 99
         $this->posts = (array) $request->getParsedBody();
102 100
         $this->gets = $request->getQueryParams();
103 101
         $this->servers = $request->getServerParams();
@@ -169,8 +167,7 @@  discard block
 block discarded – undo
169 167
      *
170 168
      * @return mixed
171 169
      */
172
-    public function get(string $key, $default = null)
173
-    {
170
+    public function get(string $key, $default = null) {
174 171
         $gets = $this->applyInputClean($this->gets);
175 172
         return Arr::get($gets, $key, $default);
176 173
     }
@@ -182,8 +179,7 @@  discard block
 block discarded – undo
182 179
      *
183 180
      * @return mixed
184 181
      */
185
-    public function post(string $key, $default = null)
186
-    {
182
+    public function post(string $key, $default = null) {
187 183
         $posts = $this->applyInputClean($this->posts);
188 184
         return Arr::get($posts, $key, $default);
189 185
     }
@@ -195,8 +191,7 @@  discard block
 block discarded – undo
195 191
      *
196 192
      * @return mixed
197 193
      */
198
-    public function server(string $key, $default = null)
199
-    {
194
+    public function server(string $key, $default = null) {
200 195
         $servers = $this->applyInputClean($this->servers);
201 196
         return Arr::get($servers, $key, $default);
202 197
     }
@@ -208,8 +203,7 @@  discard block
 block discarded – undo
208 203
      *
209 204
      * @return mixed
210 205
      */
211
-    public function cookie(string $key, $default = null)
212
-    {
206
+    public function cookie(string $key, $default = null) {
213 207
         $cookies = $this->applyInputClean($this->cookies);
214 208
         return Arr::get($cookies, $key, $default);
215 209
     }
@@ -220,8 +214,7 @@  discard block
 block discarded – undo
220 214
      *
221 215
      * @return mixed
222 216
      */
223
-    public function file(string $key)
224
-    {
217
+    public function file(string $key) {
225 218
         $files = $this->files;
226 219
         return Arr::get($files, $key, null);
227 220
     }
Please login to merge, or discard this patch.
src/Http/InputClean.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -133,11 +133,11 @@
 block discarded – undo
133 133
     }
134 134
 
135 135
         /**
136
-     * The main function to clean input
137
-     * @param mixed $str
138
-     * @param bool $isImage
139
-     * @return mixed
140
-     */
136
+         * The main function to clean input
137
+         * @param mixed $str
138
+         * @param bool $isImage
139
+         * @return mixed
140
+         */
141 141
     public function clean($str, bool $isImage = false)
142 142
     {
143 143
         if (is_array($str)) {
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
         '\'', '"', '&', '$', '#',
65 65
         '{', '}', '[', ']', '=',
66 66
         ';', '?', '%20', '%22',
67
-        '%3c',      // <
68
-        '%253c',    // <
69
-        '%3e',      // >
70
-        '%0e',      // >
71
-        '%28',      // (
72
-        '%29',      // )
73
-        '%2528',    // (
74
-        '%26',      // &
75
-        '%24',      // $
76
-        '%3f',      // ?
77
-        '%3b',      // ;
67
+        '%3c', // <
68
+        '%253c', // <
69
+        '%3e', // >
70
+        '%0e', // >
71
+        '%28', // (
72
+        '%29', // )
73
+        '%2528', // (
74
+        '%26', // &
75
+        '%24', // $
76
+        '%3f', // ?
77
+        '%3b', // ;
78 78
         '%3d'       // =
79 79
     ];
80 80
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             return $str;
149 149
         }
150 150
 
151
-        if ($str === '' || $str === null || is_bool($str) || ! $str || is_numeric($str)) {
151
+        if ($str === '' || $str === null || is_bool($str) || !$str || is_numeric($str)) {
152 152
             return $str;
153 153
         }
154 154
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 
482 482
         $flag = ENT_COMPAT | ENT_HTML5;
483 483
 
484
-        if (! isset($entities)) {
484
+        if (!isset($entities)) {
485 485
             $entities = array_map(
486 486
                 'strtolower',
487 487
                 get_html_translation_table(HTML_ENTITIES, $flag, $charset)
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
         static $naughtyTags = [
558 558
             'alert', 'area', 'prompt', 'confirm', 'applet', 'audio', 'basefont',
559 559
             'base', 'behavior', 'bgsound', 'blink', 'body', 'embed', 'expression',
560
-            'form', 'frameset', 'frame', 'head', 'html', 'ilayer','iframe', 'input',
560
+            'form', 'frameset', 'frame', 'head', 'html', 'ilayer', 'iframe', 'input',
561 561
             'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object',
562 562
             'plaintext', 'style', 'script', 'textarea', 'title', 'math', 'video', 'svg',
563 563
             'xml', 'xss'
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
                 );
602 602
                 $attribute = [];
603 603
                 if (
604
-                    ! preg_match(
604
+                    !preg_match(
605 605
                         $attributesPattern,
606 606
                         $matches['attributes'],
607 607
                         $attribute,
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
                     $attributes[] = $attribute[0][0];
624 624
                 }
625 625
 
626
-                $matches['attributes']  = (string) substr(
626
+                $matches['attributes'] = (string) substr(
627 627
                     $matches['attributes'],
628 628
                     $attribute[0][1] + strlen($attribute[0][0])
629 629
                 );
@@ -774,9 +774,9 @@  discard block
 block discarded – undo
774 774
         */
775 775
 
776 776
         if ($urlEncode) {
777
-            $nonDisplayables[] = '/%0[0-8bcef]/i';  // URL encoded 00-08, 11, 12, 14, 15
778
-            $nonDisplayables[] = '/%1[0-9a-f]/i';   // URL encoded 16-31
779
-            $nonDisplayables[] = '/%7f/i';      // URL encoded 127
777
+            $nonDisplayables[] = '/%0[0-8bcef]/i'; // URL encoded 00-08, 11, 12, 14, 15
778
+            $nonDisplayables[] = '/%1[0-9a-f]/i'; // URL encoded 16-31
779
+            $nonDisplayables[] = '/%7f/i'; // URL encoded 127
780 780
         }
781 781
 
782 782
         $nonDisplayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
  * @class InputClean
54 54
  * @package Platine\Framework\Http
55 55
  */
56
-class InputClean
57
-{
56
+class InputClean {
58 57
     /**
59 58
      * The list of invalid filename chars
60 59
      * @var array<string>
@@ -127,8 +126,7 @@  discard block
 block discarded – undo
127 126
      * Create new instance
128 127
      * @param string $charset
129 128
      */
130
-    public function __construct(string $charset = 'UTF-8')
131
-    {
129
+    public function __construct(string $charset = 'UTF-8') {
132 130
         $this->charset = $charset;
133 131
     }
134 132
 
@@ -138,8 +136,7 @@  discard block
 block discarded – undo
138 136
      * @param bool $isImage
139 137
      * @return mixed
140 138
      */
141
-    public function clean($str, bool $isImage = false)
142
-    {
139
+    public function clean($str, bool $isImage = false) {
143 140
         if (is_array($str)) {
144 141
             foreach ($str as $key => &$value) {
145 142
                 $str[$key] = $this->clean($value);
Please login to merge, or discard this patch.