Passed
Pull Request — master (#1969)
by Janko
22:34 queued 10:03
created

ShipCreator::createBy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 3
dl 0
loc 14
ccs 0
cts 8
cp 0
crap 2
rs 10
c 1
b 1
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Ship\Lib;
6
7
use Stu\Module\Spacecraft\Lib\Creation\ShipCreationConfig;
8
use Stu\Module\Spacecraft\Lib\Creation\SpacecraftConfiguratorInterface;
9
use Stu\Module\Spacecraft\Lib\Creation\SpacecraftCreatorInterface;
10
use Stu\Orm\Repository\SpacecraftBuildplanRepositoryInterface;
11
12
final class ShipCreator implements ShipCreatorInterface
13
{
14
    /** @param SpacecraftCreatorInterface<ShipWrapperInterface> $spacecraftCreator */
15 1
    public function __construct(
16
        private SpacecraftBuildplanRepositoryInterface $buildplanRepository,
17
        private SpacecraftCreatorInterface $spacecraftCreator
18 1
    ) {}
19
20
    public function createBy(
21
        int $userId,
22
        int $rumpId,
23
        int $buildplanId
24
    ): SpacecraftConfiguratorInterface {
25
26
        $configurator = $this->spacecraftCreator->createBy(
27
            $userId,
28
            $rumpId,
29
            $buildplanId,
30
            new ShipCreationConfig($this->buildplanRepository, $buildplanId)
31
        );
32
33
        return $configurator;
34
    }
35
}
36