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

UpdateUserHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 5 1
1
<?php
2
3
namespace SumoCoders\FrameworkMultiUserBundle\Command;
4
5
use SumoCoders\FrameworkMultiUserBundle\User\User;
6
use SumoCoders\FrameworkMultiUserBundle\User\UserRepository;
7
8
/**
9
 * Class CreateUserHandler
10
 */
11
class UpdateUserHandler
12
{
13
    private $userRepository;
14
15
    /**
16
     * CreateUserHandler constructor.
17
     * @param UserRepository $userRepository
18
     */
19
    public function __construct(UserRepository $userRepository){
20
        $this->userRepository = $userRepository;
21
    }
22
23
    /**
24
     * @param UpdateUser $command
25
     */
26
    public function handle(UpdateUser $command){
27
        $updatingUser = $command->user;
28
        $user = new User($command->username, $command->password, $command->displayName);
29
        $this->userRepository->update($updatingUser, $user);
30
    }
31
}
32