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

UpdateUserHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
c 3
b 1
f 1
dl 4
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\UserRepositoryCollection;
7
8 View Code Duplication
final class UpdateUserHandler extends UserHandler
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var UserRepositoryCollection
12
     */
13
    private $userRepositoryCollection;
14
15
    /**
16
     * CreateUserHandler constructor.
17
     *
18
     * @param UserRepositoryCollection $userRepositoryCollection
19
     */
20
    public function __construct(UserRepositoryCollection $userRepositoryCollection)
21
    {
22
        $this->userRepositoryCollection = $userRepositoryCollection;
23
    }
24
25
    /**
26
     * @param UpdateUser $command
27
     */
28
    public function handle(UpdateUser $command)
29
    {
30
        $updatingUser = $command->getUser();
31
        $user = new User(
32
            $command->getUsername(),
33
            $command->getPassword(),
34
            $command->getDisplayName()
35
        );
36
        $repository = $this->getUserRepositoryForUser($this->userRepositoryCollection, $updatingUser);
37
        $repository->update($updatingUser, $user);
38
    }
39
}
40