| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace App\Modules\V1\Core\Utl; |
||
| 32 | public function uploadImageBas64($image, $dir) |
||
| 33 | { |
||
| 34 | $response = []; |
||
| 35 | $image = $image; |
||
| 36 | $imageName = 'image' . uniqid() . time() . '.jpg'; |
||
| 37 | $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
||
| 38 | |||
| 39 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
||
| 40 | |||
| 41 | $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
||
| 42 | $image = \Image::make($base)->save($destinationPath . $imageName); |
||
| 43 | |||
| 44 | return url($destinationPath . $imageName); |
||
| 45 | } |
||
| 46 | |||
| 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.