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