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

UpdateCharacteristics::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 7
rs 10
1
<?php
2
3
4
namespace App\Src\UseCases\Domain\Context\UseCases;
5
6
7
use App\Src\UseCases\Domain\Ports\ContextRepository;
8
use App\Src\UseCases\Domain\Shared\Gateway\AuthGateway;
9
10
class UpdateCharacteristics
11
{
12
    private $contextRepository;
13
    private $authGateway;
14
15
    public function __construct(
16
        ContextRepository $contextRepository,
17
        AuthGateway $authGateway
18
    )
19
    {
20
        $this->contextRepository = $contextRepository;
21
        $this->authGateway = $authGateway;
22
    }
23
24
    public function execute(array $characteristics)
25
    {
26
        $currentUser = $this->authGateway->current();
27
        $context = $this->contextRepository->getByUser($currentUser->id());
28
        $context->update(['characteristics' => $characteristics], $currentUser->id());
29
    }
30
}
31