Passed
Push — master ( be27ff...1fe5d2 )
by Tomasz
02:22
created

UseCase::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 7
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Hexarchium\CoreDomain\UseCase\CreateModel;
4
5
use Hexarchium\CoreDomain\Model\Domain\Entity\Model;
6
use Hexarchium\CoreDomain\Model\Domain\Repository\DomainRepositoryInterface;
7
8
class UseCase
9
{
10
    /** @var  DomainRepositoryInterface */
11
    private $domainRepository;
12
13
    /**
14
     * UseCase constructor.
15
     *
16
     * @param DomainRepositoryInterface $domainRepository
17
     */
18
    public function __construct(DomainRepositoryInterface $domainRepository)
19
    {
20
        $this->domainRepository = $domainRepository;
21
    }
22
23
    public function handle(Command $command)
24
    {
25
        $domain = $this->domainRepository->getById($command->getDomainId());
26
27
        $model = new Model($command->getModelId());
28
        $domain->addModel($model);
29
    }
30
}
31