UseCase   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 4 1
1
<?php
2
/**
3
 *
4
 * This file is part of the Aggrego.
5
 * (c) Tomasz Kunicki <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 */
11
12
declare(strict_types = 1);
13
14
namespace Aggrego\Domain\Api\Command\CreateBoard;
15
16
use Aggrego\Domain\Board\NewBoardFactory;
17
use Aggrego\Domain\Board\Repository;
18
19
class UseCase
20
{
21
    /**
22
     * @var Repository
23
     */
24
    private $repository;
25
26
    /**
27
     * @var NewBoardFactory
28
     */
29
    private $factory;
30
31
    public function __construct(Repository $repository, NewBoardFactory $factory)
32
    {
33
        $this->repository = $repository;
34
        $this->factory = $factory;
35
    }
36
37
    /**
38
     * @param  Command $command
39
     */
40
    public function handle(Command $command): void
41
    {
42
        $board = $this->factory->newBoard($command->getKey(), $command->getProfile());
43
        $this->repository->addBoard($board);
44
    }
45
}
46