Passed
Push — develop ( 577144...bf5480 )
by
unknown
01:39
created

EditCompany::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the G.L.S.R. Apps package.
7
 *
8
 * (c) Dev-Int Création <[email protected]>.
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Company\Application\Handler;
15
16
use Company\Application\Command\EditCompany as EditCompanyCommand;
17
use Company\Application\Factory\CreateCompany as CreateCompanyFactory;
18
use Company\Domain\Storage\SaveCompany;
19
use Core\Domain\Protocol\Common\Command\CommandHandlerInterface;
20
21
final class EditCompany implements CommandHandlerInterface
22
{
23
    private SaveCompany $saveCompany;
24
    private CreateCompanyFactory $createCompany;
25
26
    public function __construct(SaveCompany $saveCompany, CreateCompanyFactory $createCompany)
27
    {
28
        $this->saveCompany = $saveCompany;
29
        $this->createCompany = $createCompany;
30
    }
31
32
    public function __invoke(EditCompanyCommand $command): void
33
    {
34
        $this->saveCompany->save(
35
            $this->createCompany->createCompany($command)
36
        );
37
    }
38
}
39