| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function upload(string $filename, $contents) : string |
||
| 17 | { |
||
| 18 | $client = new Client(); |
||
| 19 | $response = $client->request('POST', "http://$this->hostname/storage/upload", [ |
||
| 20 | 'multipart' => [ |
||
| 21 | [ |
||
| 22 | 'name' => 'file', |
||
| 23 | 'filename' => $filename, |
||
| 24 | 'contents' => $contents, |
||
| 25 | ], |
||
| 26 | ] |
||
| 27 | ]); |
||
| 28 | |||
| 29 | return json_decode($response->getBody())->hash[0]; |
||
| 30 | } |
||
| 31 | |||
| 37 |