Passed
Push — main ( aae7a5...6fad33 )
by Thierry
03:59 queued 01:12
created
src/Http/UriDetector.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
      */
40 40
     private function setScheme(array $server)
41 41
     {
42
-        if(isset($this->aUrl['scheme']))
42
+        if (isset($this->aUrl['scheme']))
43 43
         {
44 44
             return;
45 45
         }
46
-        if(isset($server['HTTP_SCHEME']))
46
+        if (isset($server['HTTP_SCHEME']))
47 47
         {
48 48
             $this->aUrl['scheme'] = $server['HTTP_SCHEME'];
49 49
             return;
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
      */
62 62
     private function setHostFromServer(array $server, string $sKey)
63 63
     {
64
-        if(isset($this->aUrl['host']) || empty($server[$sKey]))
64
+        if (isset($this->aUrl['host']) || empty($server[$sKey]))
65 65
         {
66 66
             return;
67 67
         }
68
-        if(strpos($server[$sKey], ':') === false)
68
+        if (strpos($server[$sKey], ':') === false)
69 69
         {
70 70
             $this->aUrl['host'] = $server[$sKey];
71 71
             return;
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
         $this->setHostFromServer($server, 'HTTP_X_FORWARDED_HOST');
85 85
         $this->setHostFromServer($server, 'HTTP_HOST');
86 86
         $this->setHostFromServer($server, 'SERVER_NAME');
87
-        if(empty($this->aUrl['host']))
87
+        if (empty($this->aUrl['host']))
88 88
         {
89 89
             throw new UriException();
90 90
         }
91
-        if(empty($this->aUrl['port']) && isset($server['SERVER_PORT']))
91
+        if (empty($this->aUrl['port']) && isset($server['SERVER_PORT']))
92 92
         {
93 93
             $this->aUrl['port'] = $server['SERVER_PORT'];
94 94
         }
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
      */
102 102
     private function setPath(array $server)
103 103
     {
104
-        if(isset($this->aUrl['path']) && strlen(basename($this->aUrl['path'])) === 0)
104
+        if (isset($this->aUrl['path']) && strlen(basename($this->aUrl['path'])) === 0)
105 105
         {
106 106
             unset($this->aUrl['path']);
107 107
         }
108
-        if(isset($this->aUrl['path']))
108
+        if (isset($this->aUrl['path']))
109 109
         {
110 110
             return;
111 111
         }
112 112
         $aPath = parse_url($server['PATH_INFO'] ?? $server['PHP_SELF']);
113
-        if(isset($aPath['path']))
113
+        if (isset($aPath['path']))
114 114
         {
115 115
             $this->aUrl['path'] = str_replace(['"', "'", '<', '>'], ['%22', '%27', '%3C', '%3E'], $aPath['path']);
116 116
         }
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
      */
122 122
     private function getUser(): string
123 123
     {
124
-        if(empty($this->aUrl['user']))
124
+        if (empty($this->aUrl['user']))
125 125
         {
126 126
             return '';
127 127
         }
128 128
         $sUrl = $this->aUrl['user'];
129
-        if(isset($this->aUrl['pass']))
129
+        if (isset($this->aUrl['pass']))
130 130
         {
131 131
             $sUrl .= ':' . $this->aUrl['pass'];
132 132
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     private function getPort(): string
140 140
     {
141
-        if(isset($this->aUrl['port']) &&
141
+        if (isset($this->aUrl['port']) &&
142 142
             (($this->aUrl['scheme'] === 'http' && $this->aUrl['port'] != 80) ||
143 143
                 ($this->aUrl['scheme'] === 'https' && $this->aUrl['port'] != 443)))
144 144
         {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     private function setQuery(array $server)
156 156
     {
157
-        if(empty($this->aUrl['query']))
157
+        if (empty($this->aUrl['query']))
158 158
         {
159 159
             $this->aUrl['query'] = empty($server['QUERY_STRING']) ? '' : $server['QUERY_STRING'];
160 160
         }
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
      */
166 166
     private function getQuery(): string
167 167
     {
168
-        if(empty($this->aUrl['query']))
168
+        if (empty($this->aUrl['query']))
169 169
         {
170 170
             return '';
171 171
         }
172 172
         $aQueries = explode("&", $this->aUrl['query']);
173
-        foreach($aQueries as $sKey => $sQuery)
173
+        foreach ($aQueries as $sKey => $sQuery)
174 174
         {
175
-            if(substr($sQuery, 0, 11) === 'jxnGenerate')
175
+            if (substr($sQuery, 0, 11) === 'jxnGenerate')
176 176
             {
177 177
                 unset($aQueries[$sKey]);
178 178
             }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     {
193 193
         $this->aUrl = [];
194 194
         // Try to get the request URL
195
-        if(isset($server['REQUEST_URI']))
195
+        if (isset($server['REQUEST_URI']))
196 196
         {
197 197
             $sUri = str_replace(['"', "'", '<', '>'], ['%22', '%27', '%3C', '%3E'], $server['REQUEST_URI']);
198 198
             $this->aUrl = parse_url($sUri);
Please login to merge, or discard this patch.