Passed
Push — master ( 956624...05ed8c )
by Bertrand
08:49
created

RemoveAvatar   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 11 2
1
<?php
2
3
4
namespace App\Src\UseCases\Domain\Users;
5
6
7
use App\User;
8
9
class RemoveAvatar
10
{
11
    public function execute(string $uuid)
12
    {
13
        $user = User::query()->where('uuid', $uuid)->first();
14
        if(!isset($user)){
15
            return null;
16
        }
17
        $pathPicture = $user->path_picture;
18
        $user->path_picture = '';
19
        $user->save();
20
21
        unlink(storage_path($pathPicture));
22
    }
23
}
24