Completed
Branch master (1fe5d2)
by Tomasz
03:00 queued 42s
created

UseCase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 23
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 7 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