padosoft /
HTTPClient
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Copyright (c) Padosoft.com 2016. |
||
| 4 | */ |
||
| 5 | |||
| 6 | namespace Padosoft\HTTPClient; |
||
| 7 | |||
| 8 | use GuzzleHttp\Client; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Class HttpHelper |
||
| 12 | * HTTP Helper class |
||
| 13 | * @package Padosoft\HTTPClient |
||
| 14 | */ |
||
| 15 | class HttpHelperFacade |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var Response |
||
| 19 | */ |
||
| 20 | protected $response; |
||
| 21 | /** |
||
| 22 | * @var HTTPClient |
||
| 23 | */ |
||
| 24 | protected $httpclient; |
||
| 25 | /** |
||
| 26 | * @var \Padosoft\HTTPClient\RequestHelper |
||
| 27 | */ |
||
| 28 | protected $requestHelper; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * HttpHelper constructor. |
||
| 32 | * @param HTTPClient $httpclient |
||
| 33 | */ |
||
| 34 | public function __construct(\Padosoft\HTTPClient\HTTPClient $httpclient) |
||
| 35 | { |
||
| 36 | $this->httpclient = $httpclient; |
||
| 37 | $this->requestHelper = $httpclient->requestHelper; |
||
|
0 ignored issues
–
show
|
|||
| 38 | $this->response = new Response(); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Send HTTP Request |
||
| 43 | * |
||
| 44 | * @param $method |
||
| 45 | * @param $uri |
||
| 46 | * @param array $getParams |
||
| 47 | * @param array $postParams |
||
| 48 | * @param string $user |
||
| 49 | * @param string $password |
||
| 50 | * @param array $jsonParams |
||
| 51 | * @param int $requesTimeout |
||
| 52 | * @param bool $SSLVerify |
||
| 53 | * @param array $customHeaders |
||
| 54 | * @param string $accept |
||
| 55 | * @param string $protocolVersion |
||
| 56 | * @return Response |
||
| 57 | */ |
||
| 58 | public static function sendSimpleRequest($method, $uri |
||
| 59 | , array $getParams=[], array $postParams=[] |
||
| 60 | , $user="", $password="" |
||
| 61 | , array $jsonParams=[] |
||
| 62 | , $requesTimeout=0, $SSLVerify=true |
||
| 63 | , array $customHeaders=[], $accept="", $protocolVersion="" |
||
| 64 | ) |
||
| 65 | { |
||
| 66 | |||
| 67 | $requestHelper = new RequestHelper(); |
||
| 68 | $guzzle = new Client(); |
||
| 69 | $httpClient = new HTTPClient($guzzle,$requestHelper); |
||
| 70 | $httpHelper = new HttpHelper($httpClient); |
||
| 71 | |||
| 72 | $response = $httpHelper->sendSimpleRequest($method, $uri |
||
| 73 | , $getParams, $postParams |
||
| 74 | , $user, $password |
||
| 75 | , $jsonParams |
||
| 76 | , $requesTimeout, $SSLVerify |
||
| 77 | , $customHeaders, $accept, $protocolVersion); |
||
| 78 | |||
| 79 | return $response; |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @param $uri |
||
| 84 | * @param array $getParams |
||
| 85 | * @param array $postParams |
||
| 86 | * @return Response |
||
| 87 | */ |
||
| 88 | public static function sendGet($uri, array $getParams=[], array $postParams=[]) |
||
| 89 | { |
||
| 90 | |||
| 91 | $requestHelper = new RequestHelper(); |
||
| 92 | $guzzle = new Client(); |
||
| 93 | $httpClient = new HTTPClient($guzzle,$requestHelper); |
||
| 94 | $httpHelper = new HttpHelper($httpClient); |
||
| 95 | $response = $httpHelper->sendGet($uri, $getParams, $postParams); |
||
| 96 | |||
| 97 | return $response; |
||
| 98 | |||
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @param $uri |
||
| 103 | * @param array $getParams |
||
| 104 | * @param array $postParams |
||
| 105 | * @param $user |
||
| 106 | * @param $password |
||
| 107 | * @return Response |
||
| 108 | */ |
||
| 109 | View Code Duplication | public static function sendGetWithAuth($uri, array $getParams=[], array $postParams=[], $user, $password) |
|
| 110 | { |
||
| 111 | |||
| 112 | $requestHelper = new RequestHelper(); |
||
| 113 | $guzzle = new Client(); |
||
| 114 | $httpClient = new HTTPClient($guzzle,$requestHelper); |
||
| 115 | $httpHelper = new HttpHelper($httpClient); |
||
| 116 | $response = $httpHelper->sendGetWithAuth($uri, $getParams, $postParams, $user, $password); |
||
| 117 | |||
| 118 | return $response; |
||
| 119 | |||
| 120 | |||
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @param $uri |
||
| 125 | * @param array $getParams |
||
| 126 | * @param array $postParams |
||
| 127 | * @return Response |
||
| 128 | */ |
||
| 129 | public static function sendPost($uri, array $getParams=[], array $postParams=[]) |
||
| 130 | { |
||
| 131 | $requestHelper = new RequestHelper(); |
||
| 132 | $guzzle = new Client(); |
||
| 133 | $httpClient = new HTTPClient($guzzle,$requestHelper); |
||
| 134 | $httpHelper = new HttpHelper($httpClient); |
||
| 135 | $response = $httpHelper->sendPost($uri, $getParams, $postParams); |
||
| 136 | |||
| 137 | return $response; |
||
| 138 | } |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @param $uri |
||
| 142 | * @param array $getParams |
||
| 143 | * @param array $postParams |
||
| 144 | * @param $user |
||
| 145 | * @param $password |
||
| 146 | * @return Response |
||
| 147 | */ |
||
| 148 | View Code Duplication | public static function sendPostWithAuth($uri, array $getParams=[], array $postParams=[], $user, $password) |
|
| 149 | { |
||
| 150 | $requestHelper = new RequestHelper(); |
||
| 151 | $guzzle = new Client(); |
||
| 152 | $httpClient = new HTTPClient($guzzle,$requestHelper); |
||
| 153 | $httpHelper = new HttpHelper($httpClient); |
||
| 154 | $response = $httpHelper->sendPostWithAuth($uri, $getParams, $postParams, $user, $password); |
||
| 155 | |||
| 156 | return $response; |
||
| 157 | } |
||
| 158 | |||
| 159 | /** |
||
| 160 | * @param $uri |
||
| 161 | * @param array $jsonParams |
||
| 162 | * @param $user |
||
| 163 | * @param $password |
||
| 164 | * @return Response |
||
| 165 | */ |
||
| 166 | public static function sendPostJsonWithAuth($uri, array $jsonParams=[], $user, $password) |
||
| 167 | { |
||
| 168 | $requestHelper = new RequestHelper(); |
||
| 169 | $guzzle = new Client(); |
||
| 170 | $httpClient = new HTTPClient($guzzle,$requestHelper); |
||
| 171 | $httpHelper = new HttpHelper($httpClient); |
||
| 172 | $response = $httpHelper->sendPostJsonWithAuth($uri, $jsonParams, $user, $password); |
||
| 173 | return $response; |
||
| 174 | } |
||
| 175 | |||
| 176 | |||
| 177 | } |
||
| 178 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.