RegisterHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 6 1
1
<?php declare(strict_types = 1);
2
3
namespace Simplex\Quickstart\Module\Demo\CommandHandler;
4
5
use Doctrine\ORM\EntityManager;
6
use Simplex\Quickstart\Module\Demo\Command\Register;
7
use Simplex\Quickstart\Module\Demo\Model\Person;
8
9
final class RegisterHandler
10
{
11
    /**
12
     * @var EntityManager
13
     */
14
    private $orm;
15
16 1
    public function __construct(EntityManager $orm)
17
    {
18 1
        $this->orm = $orm;
19 1
    }
20
21 1
    public function handle(Register $command): void
22
    {
23 1
        $person = Person::register($command->name, $command->email, $command->password);
24
25 1
        $this->orm->persist($person);
26 1
        $this->orm->flush();
27 1
    }
28
}
29