| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace App\Modules\V1\Core\Utl; |
||
| 12 | public function uploadImage($image, $dir) |
||
| 13 | { |
||
| 14 | $response = []; |
||
|
|
|||
| 15 | $image = $image; |
||
| 16 | $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
||
| 17 | $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
||
| 18 | |||
| 19 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
||
| 20 | $image->move($destinationPath, $imageName); |
||
| 21 | |||
| 22 | return url($destinationPath . $imageName); |
||
| 23 | } |
||
| 24 | |||
| 64 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.