| Conditions | 1 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 46 | public function create (string $file) { |
||
| 47 | assert(!$this->hasGid()); |
||
| 48 | // api returns compact version. reload. |
||
| 49 | $remote = $this->api->call('POST', "{$this->getParent()}/attachments", [ |
||
| 50 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
||
| 51 | ])['data']; |
||
| 52 | $this->data['gid'] = $remote['gid']; |
||
| 53 | $this->reload(); |
||
| 54 | return $this; |
||
| 55 | } |
||
| 56 | } |