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

CreateUserHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 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
final class CreateUserHandler
9
{
10
    /**
11
     * @var UserRepository
12
     */
13
    private $userRepository;
14
15
    /**
16
     * @param UserRepository $userRepository
17
     */
18
    public function __construct(UserRepository $userRepository)
19
    {
20
        $this->userRepository = $userRepository;
21
    }
22
23
    /**
24
     * @param CreateUser $command
25
     */
26
    public function handle(CreateUser $command)
27
    {
28
        $user = new User($command->getUsername(), $command->getPassword(), $command->getDisplayName());
29
        $this->userRepository->add($user);
30
    }
31
}
32