Completed
Pull Request — master (#10)
by
unknown
05:39 queued 02:04
created

UpdateUserHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 5
Bugs 1 Features 2
Metric Value
wmc 2
c 5
b 1
f 2
lcom 1
cbo 3
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 6 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