| Total Complexity | 2 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 5 | class ConnectUtil |
||
| 6 | { |
||
| 7 | // request |
||
| 8 | public const PARAM_NAME_REQUEST_URL = "url"; |
||
| 9 | public const PARAM_NAME_REQUEST_METHOD = "method"; |
||
| 10 | public const PARAM_NAME_REQUEST_PAYLOAD = "payload"; |
||
| 11 | public const PARAM_NAME_REQUEST_CONFIG = "request-config"; |
||
| 12 | |||
| 13 | // request methods |
||
| 14 | public const METHOD_NAME_POST = "POST"; |
||
| 15 | |||
| 16 | // config options |
||
| 17 | public const CONFIG_NAME_CONNECTION_TIMEOUT = "connection-timeout"; |
||
| 18 | public const CONFIG_NAME_SOCKET_TIMEOUT = "socket-timeout"; |
||
| 19 | |||
| 20 | // response |
||
| 21 | public const PARAM_NAME_RESPONSE_STATUS_CODE = "statusCode"; |
||
| 22 | public const PARAM_NAME_RESPONSE = "response"; |
||
| 23 | |||
| 24 | // common between request and response |
||
| 25 | public const PARAM_NAME_HEADERS = "headers"; |
||
| 26 | public const HEADER_CONTENT_TYPE = "Content-Type"; |
||
| 27 | |||
| 28 | // helper methods |
||
| 29 | public static function assembleRequestParameters( |
||
| 45 | } |
||
| 46 | |||
| 47 | public static function addRequestTimeoutConfiguration(array $requestParams, int $timeout): array |
||
| 58 |