@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function __construct(array $aOptions = [], string $sKeys = '') |
48 | 48 | { |
49 | - if(count($aOptions) > 0) |
|
49 | + if (count($aOptions) > 0) |
|
50 | 50 | { |
51 | 51 | $this->setOptions($aOptions, $sKeys); |
52 | 52 | } |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | $sPrefix = trim($sPrefix); |
81 | 81 | $nDepth = intval($nDepth); |
82 | 82 | // Check the max depth |
83 | - if($nDepth < 0 || $nDepth > 9) |
|
83 | + if ($nDepth < 0 || $nDepth > 9) |
|
84 | 84 | { |
85 | 85 | throw new Exception\DataDepth($sPrefix, $nDepth); |
86 | 86 | } |
87 | - foreach($aOptions as $sName => $xOption) |
|
87 | + foreach ($aOptions as $sName => $xOption) |
|
88 | 88 | { |
89 | - if(is_int($sName)) |
|
89 | + if (is_int($sName)) |
|
90 | 90 | { |
91 | 91 | continue; |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // Save the value of this option |
97 | 97 | $this->aOptions[$sFullName] = $xOption; |
98 | 98 | // Save the values of its sub-options |
99 | - if(is_array($xOption)) |
|
99 | + if (is_array($xOption)) |
|
100 | 100 | { |
101 | 101 | // Recursively read the options in the array |
102 | 102 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | { |
118 | 118 | // Find the config array in the input data |
119 | 119 | $aKeys = explode('.', (string)$sKeys); |
120 | - foreach($aKeys as $sKey) |
|
120 | + foreach ($aKeys as $sKey) |
|
121 | 121 | { |
122 | - if(($sKey)) |
|
122 | + if (($sKey)) |
|
123 | 123 | { |
124 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
124 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
125 | 125 | { |
126 | 126 | return $this; |
127 | 127 | } |
@@ -170,14 +170,13 @@ discard block |
||
170 | 170 | $sPrefix = rtrim(trim($sPrefix), '.') . '.'; |
171 | 171 | $sPrefixLen = strlen($sPrefix); |
172 | 172 | $aOptions = []; |
173 | - foreach($this->aOptions as $sName => $xValue) |
|
173 | + foreach ($this->aOptions as $sName => $xValue) |
|
174 | 174 | { |
175 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
175 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
176 | 176 | { |
177 | 177 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
178 | 178 | $sOptionName = $iNextDotPos === false ? |
179 | - substr($sName, $sPrefixLen) : |
|
180 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
179 | + substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
181 | 180 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
182 | 181 | } |
183 | 182 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | */ |
33 | 33 | private function setScheme(array &$aUrl) |
34 | 34 | { |
35 | - if(!empty($aUrl['scheme'])) |
|
35 | + if (!empty($aUrl['scheme'])) |
|
36 | 36 | { |
37 | 37 | return; |
38 | 38 | } |
39 | - if(!empty($_SERVER['HTTP_SCHEME'])) |
|
39 | + if (!empty($_SERVER['HTTP_SCHEME'])) |
|
40 | 40 | { |
41 | 41 | $aUrl['scheme'] = $_SERVER['HTTP_SCHEME']; |
42 | 42 | return; |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | */ |
55 | 55 | private function setHostFromServer(array &$aUrl, string $sKey) |
56 | 56 | { |
57 | - if(!empty($aUrl['host']) && !empty($_SERVER[$sKey])) |
|
57 | + if (!empty($aUrl['host']) && !empty($_SERVER[$sKey])) |
|
58 | 58 | { |
59 | 59 | return; |
60 | 60 | } |
61 | - if(strpos($_SERVER[$sKey], ':') === false) |
|
61 | + if (strpos($_SERVER[$sKey], ':') === false) |
|
62 | 62 | { |
63 | 63 | $aUrl['host'] = $_SERVER[$sKey]; |
64 | 64 | return; |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | $this->setHostFromServer($aUrl, 'HTTP_X_FORWARDED_HOST'); |
78 | 78 | $this->setHostFromServer($aUrl, 'HTTP_HOST'); |
79 | 79 | $this->setHostFromServer($aUrl, 'SERVER_NAME'); |
80 | - if(empty($aUrl['host'])) |
|
80 | + if (empty($aUrl['host'])) |
|
81 | 81 | { |
82 | 82 | throw new Error(); |
83 | 83 | } |
84 | - if(empty($aUrl['port']) && !empty($_SERVER['SERVER_PORT'])) |
|
84 | + if (empty($aUrl['port']) && !empty($_SERVER['SERVER_PORT'])) |
|
85 | 85 | { |
86 | 86 | $aUrl['port'] = $_SERVER['SERVER_PORT']; |
87 | 87 | } |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | */ |
95 | 95 | private function setPath(array &$aUrl) |
96 | 96 | { |
97 | - if(!empty($aUrl['path']) && strlen(basename($aUrl['path'])) === 0) |
|
97 | + if (!empty($aUrl['path']) && strlen(basename($aUrl['path'])) === 0) |
|
98 | 98 | { |
99 | 99 | unset($aUrl['path']); |
100 | 100 | } |
101 | - if(!empty($aUrl['path'])) |
|
101 | + if (!empty($aUrl['path'])) |
|
102 | 102 | { |
103 | 103 | return; |
104 | 104 | } |
105 | 105 | $sPath = parse_url(!empty($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : $_SERVER['PHP_SELF']); |
106 | - if(isset($sPath['path'])) |
|
106 | + if (isset($sPath['path'])) |
|
107 | 107 | { |
108 | 108 | $aUrl['path'] = str_replace(['"', "'", '<', '>'], ['%22', '%27', '%3C', '%3E'], $sPath['path']); |
109 | 109 | } |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | */ |
117 | 117 | private function getUser(array $aUrl) |
118 | 118 | { |
119 | - if(empty($aUrl['user'])) |
|
119 | + if (empty($aUrl['user'])) |
|
120 | 120 | { |
121 | 121 | return ''; |
122 | 122 | } |
123 | 123 | $sUrl = $aUrl['user']; |
124 | - if(!empty($aUrl['pass'])) |
|
124 | + if (!empty($aUrl['pass'])) |
|
125 | 125 | { |
126 | 126 | $sUrl .= ':' . $aUrl['pass']; |
127 | 127 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private function getPort(array $aUrl) |
137 | 137 | { |
138 | - if(!empty($aUrl['port']) && |
|
138 | + if (!empty($aUrl['port']) && |
|
139 | 139 | (($aUrl['scheme'] === 'http' && $aUrl['port'] != 80) || |
140 | 140 | ($aUrl['scheme'] === 'https' && $aUrl['port'] != 443))) |
141 | 141 | { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | private function setQuery(array &$aUrl) |
153 | 153 | { |
154 | - if(empty($aUrl['query'])) |
|
154 | + if (empty($aUrl['query'])) |
|
155 | 155 | { |
156 | 156 | $aUrl['query'] = empty($_SERVER['QUERY_STRING']) ? '' : $_SERVER['QUERY_STRING']; |
157 | 157 | } |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function getQuery(array $aUrl) |
166 | 166 | { |
167 | - if(empty($aUrl['query'])) |
|
167 | + if (empty($aUrl['query'])) |
|
168 | 168 | { |
169 | 169 | return ''; |
170 | 170 | } |
171 | 171 | $aQueries = explode("&", $aUrl['query']); |
172 | - foreach($aQueries as $sKey => $sQuery) |
|
172 | + foreach ($aQueries as $sKey => $sQuery) |
|
173 | 173 | { |
174 | - if(substr($sQuery, 0, 11) === 'jxnGenerate') |
|
174 | + if (substr($sQuery, 0, 11) === 'jxnGenerate') |
|
175 | 175 | { |
176 | 176 | unset($aQueries[$sKey]); |
177 | 177 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | $aUrl = []; |
191 | 191 | // Try to get the request URL |
192 | - if(!empty($_SERVER['REQUEST_URI'])) |
|
192 | + if (!empty($_SERVER['REQUEST_URI'])) |
|
193 | 193 | { |
194 | 194 | $_SERVER['REQUEST_URI'] = str_replace(['"', "'", '<', '>'], ['%22', '%27', '%3C', '%3E'], $_SERVER['REQUEST_URI']); |
195 | 195 | $aUrl = parse_url($_SERVER['REQUEST_URI']); |