SignUpHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 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
}