Revision 31
Added by Manuela over 6 years ago
HttpRequester.php | ||
---|---|---|
33 | 33 |
//declare(strict_types = 1); |
34 | 34 |
//declare(encoding = 'UTF-8'); |
35 | 35 |
|
36 |
namespace bin; |
|
36 |
namespace bin\requester;
|
|
37 | 37 |
|
38 | 38 |
use bin\interfaces\RequesterInterface; |
39 | 39 |
|
... | ... | |
50 | 50 |
*/ |
51 | 51 |
public function __construct() |
52 | 52 |
{ |
53 |
// $this->aServer = \filter_input_array(INPUT_SERVER); |
|
54 | 53 |
$aServer = \filter_input_array(INPUT_SERVER); |
55 | 54 |
switch (\strtolower($aServer['REQUEST_METHOD'])): |
56 | 55 |
case 'post': |
... | ... | |
60 | 59 |
$this->aParameters = \filter_input_array(INPUT_GET); |
61 | 60 |
break; |
62 | 61 |
default: |
63 |
$this->aParameters = []; |
|
64 | 62 |
break; |
65 | 63 |
endswitch; |
64 |
if ($this->aParameters == null) { $this->aParameters = []; } |
|
66 | 65 |
foreach ($aServer as $sKey => $sValue) { |
67 |
if (substr_compare($sKey, 'HTTP_', 0, 5) === 0) { |
|
66 |
if (\substr_compare($sKey, 'HTTP_', 0, 5) === 0) {
|
|
68 | 67 |
$this->aHeaders[$sKey] = $sValue; |
69 | 68 |
} else { |
70 | 69 |
$this->aServer[$sKey] = $sValue; |
... | ... | |
86 | 85 |
*/ |
87 | 86 |
public function issetParam($sParamName) |
88 | 87 |
{ |
88 |
|
|
89 | 89 |
return \array_key_exists($sParamName, $this->aParameters); |
90 | 90 |
} |
91 | 91 |
/** |
... | ... | |
134 | 134 |
public function getHeader($sHeaderName) |
135 | 135 |
{ |
136 | 136 |
$sRetval = null; |
137 |
$sVarname = 'HTTP_'.preg_replace('/^http_/i', '', $sHeaderName); |
|
137 |
$sVarname = 'HTTP_'.\preg_replace('/^http_/i', '', $sHeaderName);
|
|
138 | 138 |
if ($this->issetHeader($sVarname)) { |
139 | 139 |
$sRetval = $this->aHeaders($sVarname); |
140 | 140 |
} |
Also available in: Unified diff
little fix in HttpRequester::__construct()