Passed
Push — master ( 5e83b7...81caf8 )
by Tomasz
02:02
created

UseCase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A handle() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Aggrego\Domain\Api\Command\CreateBoard;
6
7
use Aggrego\Domain\Api\Command\CreateBoard\Exception\InvalidCommandDataException;
8
use Aggrego\Domain\Board\Factory;
9
use Aggrego\Domain\Board\Repository;
10
11
class UseCase
12
{
13
    /** @var Repository */
14
    private $repository;
15
16
    /** @var Factory */
17
    private $factory;
18
19
    public function __construct(
20
        Repository $repository,
21
        Factory $factory
22
    )
23
    {
24
        $this->repository = $repository;
25
        $this->factory = $factory;
26
    }
27
28
    /**
29
     * @param Command $command
30
     * @throws InvalidCommandDataException
31
     */
32
    public function handle(Command $command): void
33
    {
34
        $this->repository->addBoard(
35
            $this->factory->newBoard($command->getKey(), $command->getProfile())
36
        );
37
    }
38
}
39