| Conditions | 3 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | public function uploadImage($path, $type = 'icon') |
||
| 44 | { |
||
| 45 | if (!file_exists($path) || !is_readable($path)) { |
||
| 46 | throw new InvalidArgumentException("File does not exist, or the file is unreadable: '$path'"); |
||
| 47 | } |
||
| 48 | |||
| 49 | $type = strtolower($type); |
||
| 50 | |||
| 51 | return $this->parseJSON('upload', [self::API_MATERIAL_ADD, ['media' => $path], [], ['type' => $type]]); |
||
| 52 | } |
||
| 53 | } |
||
| 54 |