SignUpHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 11 1
1
<?php
2
namespace Appliga\Customer\App\Command;
3
4
use Appliga\Customer\Domain\Entity\Customer;
5
use Appliga\Customer\Domain\Repository\CustomerRepository;
6
use Appliga\General\Domain\ValueObject\Email;
7
8
class SignUpHandler
9
{
10
    /**
11
     * @var CustomerRepository
12
     */
13
    protected $customerRepository;
14
15
    public function __construct(CustomerRepository $customerRepository)
16
    {
17
        $this->customerRepository = $customerRepository;
18
    }
19
20
    public function handle(SignUp $command)
21
    {
22
        $customer = new Customer(
23
            $command->getId(),
24
            $command->getName(),
25
            new Email($command->getEmail()),
26
            $command->getPassword()
27
        );
28
29
        $this->customerRepository->save($customer);
30
    }
31
}