Passed
Push — dev ( d85471...98511f )
by Janko
18:01
created

ShipCreator::createBy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 3
dl 0
loc 11
ccs 0
cts 6
cp 0
crap 2
rs 10
c 0
b 0
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
        return $this->spacecraftCreator->createBy(
27
            $userId,
28
            $rumpId,
29
            $buildplanId,
30
            new ShipCreationConfig($this->buildplanRepository, $buildplanId)
31
        );
32
    }
33
}
34