Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | public function upload(string $path) |
||
37 | { |
||
38 | if (!file_exists($path) || !is_readable($path)) { |
||
39 | throw new InvalidArgumentException(sprintf("File does not exist, or the file is unreadable: '%s'", $path)); |
||
40 | } |
||
41 | |||
42 | $form = [ |
||
43 | 'media_hash' => strtolower(md5_file($path)), |
||
44 | 'sign_type' => 'HMAC-SHA256', |
||
45 | ]; |
||
46 | |||
47 | return $this->httpUpload('secapi/mch/uploadmedia', ['media' => $path], $form); |
||
48 | } |
||
50 |