Completed
Pull Request — master (#10)
by
unknown
13:10
created

UpdateUserHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace SumoCoders\FrameworkMultiUserBundle\Command;
4
5
use SumoCoders\FrameworkMultiUserBundle\User\User;
6
use SumoCoders\FrameworkMultiUserBundle\User\UserRepository;
7
8
final class UpdateUserHandler
9
{
10
    /**
11
     * @var UserRepository
12
     */
13
    private $userRepository;
14
15
    /**
16
     * CreateUserHandler constructor.
17
     *
18
     * @param UserRepository $userRepository
19
     */
20
    public function __construct(UserRepository $userRepository)
21
    {
22
        $this->userRepository = $userRepository;
23
    }
24
25
    /**
26
     * @param UpdateUser $command
27
     */
28
    public function handle(UpdateUser $command)
29
    {
30
        $updatingUser = $command->getUser();
31
        $user = new User($command->getUsername(), $command->getPassword(), $command->getDisplayName());
32
        $this->userRepository->update($updatingUser, $user);
33
    }
34
}
35