Passed
Push — master ( 324022...c1dc8a )
by refat
03:19
created
Core/System/Http/Request.php 3 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -6,23 +6,23 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Request
8 8
 {
9
-  private $app;
9
+    private $app;
10 10
 
11
-  private $url;
11
+    private $url;
12 12
 
13
-  private $baseUrl;
13
+    private $baseUrl;
14 14
 
15
-  private $files = [];
15
+    private $files = [];
16 16
 
17
-  private $link;
17
+    private $link;
18 18
 
19
-  public function __construct(Application $app)
20
-  {
19
+    public function __construct(Application $app)
20
+    {
21 21
     $this->app = $app;
22
-  }
22
+    }
23 23
 
24
-  public function prepareUrl()
25
-  {
24
+    public function prepareUrl()
25
+    {
26 26
     $script = dirname($this->server('SCRIPT_NAME'));
27 27
 
28 28
     $requestUri = $this->server('REQUEST_URI');
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 
32 32
     if (! in_array($script, ['/', '\\'])) {
33 33
 
34
-      $this->url = preg_replace('#^' . $script . '#', '', $requestUri);
34
+        $this->url = preg_replace('#^' . $script . '#', '', $requestUri);
35 35
     } else {
36 36
 
37
-      $this->url = $requestUri;
37
+        $this->url = $requestUri;
38 38
     }
39 39
 
40 40
     if ($this->url !== '/') $this->url = rtrim($this->url, '/');
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 
44 44
     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
45 45
 
46
-      $isSecure = true;
46
+        $isSecure = true;
47 47
 
48 48
     }
49 49
     elseif ((! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) || (! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')) {
50
-      $isSecure = true;
50
+        $isSecure = true;
51 51
     }
52 52
 
53 53
     $REQUEST_PROTOCOL = $isSecure ? 'https' : 'http';
@@ -55,51 +55,51 @@  discard block
 block discarded – undo
55 55
     $this->link = $REQUEST_PROTOCOL . '://' . $this->server('HTTP_HOST');
56 56
 
57 57
     $this->baseUrl = $this->link . $requestUri;
58
-  }
58
+    }
59 59
 
60
-  public function get($key)
61
-  {
60
+    public function get($key)
61
+    {
62 62
     $value = array_get($_GET, $key);
63 63
 
64 64
     if (is_array($value)) {
65
-      $value = array_filter($value);
65
+        $value = array_filter($value);
66 66
     } else {
67
-      $value = trim($value);
67
+        $value = trim($value);
68 68
     }
69 69
 
70 70
     return $value;
71
-  }
71
+    }
72 72
 
73
-  public function post($key)
74
-  {
73
+    public function post($key)
74
+    {
75 75
     $value = array_get($_POST, $key);
76 76
 
77 77
     if (is_array($value)) {
78
-      $value = array_filter($value);
78
+        $value = array_filter($value);
79 79
     } else {
80
-      $value = trim($value);
80
+        $value = trim($value);
81 81
     }
82 82
 
83 83
     return $value;
84
-  }
84
+    }
85 85
 
86
-  public function setPost($key, $value)
87
-  {
86
+    public function setPost($key, $value)
87
+    {
88 88
     $_POST[$key] = $value;
89
-  }
89
+    }
90 90
 
91
-  public function posts()
92
-  {
91
+    public function posts()
92
+    {
93 93
     return $_POST;
94
-  }
94
+    }
95 95
 
96
-  public function files()
97
-  {
96
+    public function files()
97
+    {
98 98
     return $_FILES;
99
-  }
99
+    }
100 100
 
101
-  public function file($input)
102
-  {
101
+    public function file($input)
102
+    {
103 103
     if (isset($this->files[$input])) return $this->files[$input];
104 104
 
105 105
     $upoadedFile = new UploadeFile($this->app, $input);
@@ -107,35 +107,35 @@  discard block
 block discarded – undo
107 107
     $this->files[$input] = $upoadedFile;
108 108
 
109 109
     return $this->files[$input];
110
-  }
110
+    }
111 111
 
112
-  public function server($key)
113
-  {
112
+    public function server($key)
113
+    {
114 114
     return array_get($_SERVER, $key);
115
-  }
115
+    }
116 116
 
117
-  public function method()
118
-  {
117
+    public function method()
118
+    {
119 119
     return $this->server('REQUEST_METHOD');
120
-  }
120
+    }
121 121
 
122
-  public function referer()
123
-  {
122
+    public function referer()
123
+    {
124 124
     return $this->server('HTTP_REFERER');
125
-  }
125
+    }
126 126
 
127
-  public function baseUrl()
128
-  {
127
+    public function baseUrl()
128
+    {
129 129
     return $this->baseUrl;
130
-  }
130
+    }
131 131
 
132
-  public function url()
133
-  {
132
+    public function url()
133
+    {
134 134
     return $this->url;
135
-  }
135
+    }
136 136
 
137
-  public function link()
138
-  {
137
+    public function link()
138
+    {
139 139
     return $this->link;
140
-  }
140
+    }
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     if (strpos($requestUri, '?')) list($requestUri, $queryString) = explode('?', $requestUri);
31 31
 
32
-    if (! in_array($script, ['/', '\\'])) {
32
+    if (!in_array($script, ['/', '\\'])) {
33 33
 
34 34
       $this->url = preg_replace('#^' . $script . '#', '', $requestUri);
35 35
     } else {
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
       $isSecure = true;
47 47
 
48 48
     }
49
-    elseif ((! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) || (! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')) {
49
+    elseif ((!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') || (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')) {
50 50
       $isSecure = true;
51 51
     }
52 52
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 
28 28
     $requestUri = $this->server('REQUEST_URI');
29 29
 
30
-    if (strpos($requestUri, '?')) list($requestUri, $queryString) = explode('?', $requestUri);
30
+    if (strpos($requestUri, '?')) {
31
+        list($requestUri, $queryString) = explode('?', $requestUri);
32
+    }
31 33
 
32 34
     if (! in_array($script, ['/', '\\'])) {
33 35
 
@@ -37,7 +39,9 @@  discard block
 block discarded – undo
37 39
       $this->url = $requestUri;
38 40
     }
39 41
 
40
-    if ($this->url !== '/') $this->url = rtrim($this->url, '/');
42
+    if ($this->url !== '/') {
43
+        $this->url = rtrim($this->url, '/');
44
+    }
41 45
 
42 46
     $isSecure = false;
43 47
 
@@ -45,8 +49,7 @@  discard block
 block discarded – undo
45 49
 
46 50
       $isSecure = true;
47 51
 
48
-    }
49
-    elseif ((! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) || (! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')) {
52
+    } elseif ((! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) || (! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')) {
50 53
       $isSecure = true;
51 54
     }
52 55
 
@@ -100,7 +103,9 @@  discard block
 block discarded – undo
100 103
 
101 104
   public function file($input)
102 105
   {
103
-    if (isset($this->files[$input])) return $this->files[$input];
106
+    if (isset($this->files[$input])) {
107
+        return $this->files[$input];
108
+    }
104 109
 
105 110
     $upoadedFile = new UploadeFile($this->app, $input);
106 111
 
Please login to merge, or discard this patch.