| @@ 111-140 (lines=30) @@ | ||
| 108 | ); |
|
| 109 | } |
|
| 110 | ||
| 111 | private function makeRequest(array $basicAuth, $requestMethod, $pathInfo, array $getData = [], array $postData = []) |
|
| 112 | { |
|
| 113 | $response = $this->service->run( |
|
| 114 | new Request( |
|
| 115 | [ |
|
| 116 | 'SERVER_PORT' => 80, |
|
| 117 | 'SERVER_NAME' => 'vpn.example', |
|
| 118 | 'REQUEST_METHOD' => $requestMethod, |
|
| 119 | 'PATH_INFO' => sprintf('/%s', $pathInfo), |
|
| 120 | 'REQUEST_URI' => sprintf('/%s', $pathInfo), |
|
| 121 | 'PHP_AUTH_USER' => $basicAuth[0], |
|
| 122 | 'PHP_AUTH_PW' => $basicAuth[1], |
|
| 123 | ], |
|
| 124 | $getData, |
|
| 125 | $postData |
|
| 126 | ) |
|
| 127 | ); |
|
| 128 | ||
| 129 | $responseArray = json_decode($response->getBody(), true)[$pathInfo]; |
|
| 130 | if ($responseArray['ok']) { |
|
| 131 | if (array_key_exists('data', $responseArray)) { |
|
| 132 | return $responseArray['data']; |
|
| 133 | } |
|
| 134 | ||
| 135 | return true; |
|
| 136 | } |
|
| 137 | ||
| 138 | // in case of errors... |
|
| 139 | return $responseArray; |
|
| 140 | } |
|
| 141 | } |
|
| 142 | ||
| @@ 158-187 (lines=30) @@ | ||
| 155 | ); |
|
| 156 | } |
|
| 157 | ||
| 158 | private function makeRequest(array $basicAuth, $requestMethod, $pathInfo, array $getData = [], array $postData = []) |
|
| 159 | { |
|
| 160 | $response = $this->service->run( |
|
| 161 | new Request( |
|
| 162 | [ |
|
| 163 | 'SERVER_PORT' => 80, |
|
| 164 | 'SERVER_NAME' => 'vpn.example', |
|
| 165 | 'REQUEST_METHOD' => $requestMethod, |
|
| 166 | 'PATH_INFO' => sprintf('/%s', $pathInfo), |
|
| 167 | 'REQUEST_URI' => sprintf('/%s', $pathInfo), |
|
| 168 | 'PHP_AUTH_USER' => $basicAuth[0], |
|
| 169 | 'PHP_AUTH_PW' => $basicAuth[1], |
|
| 170 | ], |
|
| 171 | $getData, |
|
| 172 | $postData |
|
| 173 | ) |
|
| 174 | ); |
|
| 175 | ||
| 176 | $responseArray = json_decode($response->getBody(), true)[$pathInfo]; |
|
| 177 | if ($responseArray['ok']) { |
|
| 178 | if (array_key_exists('data', $responseArray)) { |
|
| 179 | return $responseArray['data']; |
|
| 180 | } |
|
| 181 | ||
| 182 | return true; |
|
| 183 | } |
|
| 184 | ||
| 185 | // in case of errors... |
|
| 186 | return $responseArray; |
|
| 187 | } |
|
| 188 | } |
|
| 189 | ||
| @@ 94-123 (lines=30) @@ | ||
| 91 | ); |
|
| 92 | } |
|
| 93 | ||
| 94 | private function makeRequest(array $basicAuth, $requestMethod, $pathInfo, array $getData = [], array $postData = []) |
|
| 95 | { |
|
| 96 | $response = $this->service->run( |
|
| 97 | new Request( |
|
| 98 | [ |
|
| 99 | 'SERVER_PORT' => 80, |
|
| 100 | 'SERVER_NAME' => 'vpn.example', |
|
| 101 | 'REQUEST_METHOD' => $requestMethod, |
|
| 102 | 'PATH_INFO' => sprintf('/%s', $pathInfo), |
|
| 103 | 'REQUEST_URI' => sprintf('/%s', $pathInfo), |
|
| 104 | 'PHP_AUTH_USER' => $basicAuth[0], |
|
| 105 | 'PHP_AUTH_PW' => $basicAuth[1], |
|
| 106 | ], |
|
| 107 | $getData, |
|
| 108 | $postData |
|
| 109 | ) |
|
| 110 | ); |
|
| 111 | ||
| 112 | $responseArray = json_decode($response->getBody(), true)[$pathInfo]; |
|
| 113 | if ($responseArray['ok']) { |
|
| 114 | if (array_key_exists('data', $responseArray)) { |
|
| 115 | return $responseArray['data']; |
|
| 116 | } |
|
| 117 | ||
| 118 | return true; |
|
| 119 | } |
|
| 120 | ||
| 121 | // in case of errors... |
|
| 122 | return $responseArray; |
|
| 123 | } |
|
| 124 | } |
|
| 125 | ||
| @@ 99-128 (lines=30) @@ | ||
| 96 | ); |
|
| 97 | } |
|
| 98 | ||
| 99 | private function makeRequest(array $basicAuth, $requestMethod, $pathInfo, array $getData = [], array $postData = []) |
|
| 100 | { |
|
| 101 | $response = $this->service->run( |
|
| 102 | new Request( |
|
| 103 | [ |
|
| 104 | 'SERVER_PORT' => 80, |
|
| 105 | 'SERVER_NAME' => 'vpn.example', |
|
| 106 | 'REQUEST_METHOD' => $requestMethod, |
|
| 107 | 'PATH_INFO' => sprintf('/%s', $pathInfo), |
|
| 108 | 'REQUEST_URI' => sprintf('/%s', $pathInfo), |
|
| 109 | 'PHP_AUTH_USER' => $basicAuth[0], |
|
| 110 | 'PHP_AUTH_PW' => $basicAuth[1], |
|
| 111 | ], |
|
| 112 | $getData, |
|
| 113 | $postData |
|
| 114 | ) |
|
| 115 | ); |
|
| 116 | ||
| 117 | $responseArray = json_decode($response->getBody(), true)[$pathInfo]; |
|
| 118 | if ($responseArray['ok']) { |
|
| 119 | if (array_key_exists('data', $responseArray)) { |
|
| 120 | return $responseArray['data']; |
|
| 121 | } |
|
| 122 | ||
| 123 | return true; |
|
| 124 | } |
|
| 125 | ||
| 126 | // in case of errors... |
|
| 127 | return $responseArray; |
|
| 128 | } |
|
| 129 | } |
|
| 130 | ||
| @@ 273-302 (lines=30) @@ | ||
| 270 | ); |
|
| 271 | } |
|
| 272 | ||
| 273 | private function makeRequest(array $basicAuth, $requestMethod, $pathInfo, array $getData = [], array $postData = []) |
|
| 274 | { |
|
| 275 | $response = $this->service->run( |
|
| 276 | new Request( |
|
| 277 | [ |
|
| 278 | 'SERVER_PORT' => 80, |
|
| 279 | 'SERVER_NAME' => 'vpn.example', |
|
| 280 | 'REQUEST_METHOD' => $requestMethod, |
|
| 281 | 'PATH_INFO' => sprintf('/%s', $pathInfo), |
|
| 282 | 'REQUEST_URI' => sprintf('/%s', $pathInfo), |
|
| 283 | 'PHP_AUTH_USER' => $basicAuth[0], |
|
| 284 | 'PHP_AUTH_PW' => $basicAuth[1], |
|
| 285 | ], |
|
| 286 | $getData, |
|
| 287 | $postData |
|
| 288 | ) |
|
| 289 | ); |
|
| 290 | ||
| 291 | $responseArray = json_decode($response->getBody(), true)[$pathInfo]; |
|
| 292 | if ($responseArray['ok']) { |
|
| 293 | if (array_key_exists('data', $responseArray)) { |
|
| 294 | return $responseArray['data']; |
|
| 295 | } |
|
| 296 | ||
| 297 | return true; |
|
| 298 | } |
|
| 299 | ||
| 300 | // in case of errors... |
|
| 301 | return $responseArray; |
|
| 302 | } |
|
| 303 | } |
|
| 304 | ||