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