| Conditions | 4 |
| Paths | 6 |
| Total Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | function UPCASE($input = null, Client $client = null) |
||
| 16 | { |
||
| 17 | // BUILD AN HTTP CLIENT IF ONE WASN'T PROVIDED FOR TESTING. |
||
| 18 | if (is_null($client)) { |
||
| 19 | $client = new Client( |
||
| 20 | [ |
||
| 21 | 'base_uri' => 'http://API.SHOUTCLOUD.IO', |
||
| 22 | 'headers' => [ |
||
| 23 | 'Content-Type' => 'application/json', |
||
| 24 | ], |
||
| 25 | ] |
||
| 26 | ); |
||
| 27 | } |
||
| 28 | |||
| 29 | // CHUMP DON'T WANT THE HELP CHUMP DON'T GET THE HELP. |
||
| 30 | if (empty($input)) { |
||
| 31 | return $input; |
||
| 32 | } |
||
| 33 | |||
| 34 | $options = ['body' => json_encode(['INPUT' => $input])]; |
||
| 35 | |||
| 36 | // THIS IS WHY WE HAVE THE INTERNET. |
||
| 37 | try { |
||
| 38 | $response = $client->request('post', '/V1/SHOUT', $options)->getBody()->getContents(); |
||
| 39 | } catch (\Exception $e) { |
||
| 40 | throw new Exception($e->getMessage(), $e->getCode(), $e); |
||
| 41 | } |
||
| 42 | |||
| 43 | return json_decode($response)->OUTPUT; |
||
| 44 | } |
||
| 45 |