RegisterHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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