| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 49 | public function post($url, $data = null) |
||
| 50 | { |
||
| 51 | $headers = array( |
||
| 52 | 'Accept' => 'application/json', |
||
| 53 | 'Content-Type' => 'application/json', |
||
| 54 | ); |
||
| 55 | if ($this->apiKey) { |
||
| 56 | $headers['Api-Key'] = $this->apiKey; |
||
| 57 | } |
||
| 58 | $response = wp_remote_post($url, array( |
||
| 59 | 'headers' => $headers, |
||
| 60 | 'body' => json_encode($data), |
||
| 61 | 'timeout' => $this->timeout, |
||
| 62 | )); |
||
| 63 | if (is_array($response)) { |
||
| 64 | $response = json_decode($response['body'], true); |
||
| 65 | return $response; |
||
| 66 | } |
||
| 67 | } |
||
| 68 | |||
| 70 |