| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 11 | public function uploadLogo() |
||
| 12 | { |
||
| 13 | $item = $this->getModelFromRequest(); |
||
|
|
|||
| 14 | |||
| 15 | $type = $_REQUEST['type']; |
||
| 16 | if (in_array($type, $item->logoTypes)) { |
||
| 17 | $image = $item->uploadLogo($type); |
||
| 18 | |||
| 19 | if (is_object($image)) { |
||
| 20 | $response['type'] = 'success'; |
||
| 21 | $response['url'] = $image->getUrl(); |
||
| 22 | $response['path'] = $image->getPath(); |
||
| 23 | $response['imageType'] = $image->getImageType(); |
||
| 24 | $this->setResponseValues($response); |
||
| 25 | } else { |
||
| 26 | $this->sendError($item->errors['upload']); |
||
| 27 | } |
||
| 28 | } else { |
||
| 29 | $this->sendError('bad logo type'); |
||
| 30 | } |
||
| 56 |