| Conditions | 5 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 5 | public function remove($id) |
|
| 31 | { |
||
| 32 | 5 | if (! $id) { |
|
| 33 | 1 | return false; |
|
| 34 | } |
||
| 35 | 4 | $asset = Asset::find($id)->first(); |
|
| 36 | 4 | $media = $asset->media; |
|
| 37 | 4 | foreach ($media as $file) { |
|
| 38 | 4 | if (! is_file(public_path($file->getUrl())) || ! is_writable(public_path($file->getUrl()))) { |
|
| 39 | 4 | throw new FileNotAccessibleException(); |
|
| 40 | } |
||
| 41 | } |
||
| 42 | 3 | $asset->delete(); |
|
| 43 | 3 | } |
|
| 55 |