Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function __invoke(CreateCompany $command): void |
||
32 | { |
||
33 | if ($this->repository->companyExist()) { |
||
34 | throw new \DomainException('A company is already create.'); |
||
35 | } |
||
36 | if ($this->repository->existsWithName($command->name()->getValue())) { |
||
37 | throw new \DomainException("Company with name: {$command->name()->getValue()} already exists."); |
||
38 | } |
||
39 | |||
40 | $company = $this->createCompany($command); |
||
41 | |||
42 | $this->repository->add($company); |
||
43 | } |
||
62 |