| Conditions | 3 |
| Paths | 3 |
| Total Lines | 25 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 45 | private function checkFileUploadRequest($options) |
||
| 46 | { |
||
| 47 | if (!array_key_exists('upload', $options)) { |
||
| 48 | return $options; |
||
| 49 | } |
||
| 50 | |||
| 51 | $fileName = $options['upload']; |
||
| 52 | unset($options['upload']); |
||
| 53 | |||
| 54 | if (!$fileName) { |
||
| 55 | return $options; |
||
| 56 | } |
||
| 57 | |||
| 58 | // We send the data in URL |
||
| 59 | $options['query'] = ['metadata' => json_encode($options['json'])]; |
||
| 60 | |||
| 61 | // Guzzle modify header if we send json. |
||
| 62 | unset($options['json']); |
||
| 63 | |||
| 64 | // We send file only |
||
| 65 | $options['body'] = fopen($fileName, 'r'); |
||
| 66 | |||
| 67 | return $options; |
||
| 68 | |||
| 69 | } |
||
| 70 | } |
||
| 71 |