Passed
Push — master ( 6b02b9...a180a6 )
by Nico
26:39 queued 18:43
created

StationUiFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Station\Lib;
6
7
use Stu\Lib\Map\VisualPanel\SystemScanPanelEntry;
8
use Stu\Lib\Map\VisualPanel\VisualPanelEntryData;
9
use Stu\Module\Logging\LoggerUtilInterface;
10
use Stu\Orm\Entity\DockingPrivilegeInterface;
11
use Stu\Orm\Entity\ShipInterface;
12
use Stu\Orm\Entity\StarSystemInterface;
13
use Stu\Orm\Entity\UserInterface;
14
use Stu\Orm\Repository\AllianceRepositoryInterface;
15
use Stu\Orm\Repository\FactionRepositoryInterface;
16
use Stu\Orm\Repository\ShipRepositoryInterface;
17
use Stu\Orm\Repository\UserRepositoryInterface;
18
19
/**
20
 * Creates ui and station related items
21
 */
22
final class StationUiFactory implements StationUiFactoryInterface
23
{
24
    private UserRepositoryInterface $userRepository;
25
26
    private AllianceRepositoryInterface $allianceRepository;
27
28
    private FactionRepositoryInterface $factionRepository;
29
30
    private ShipRepositoryInterface $shipRepository;
31
32 1
    public function __construct(
33
        UserRepositoryInterface $userRepository,
34
        AllianceRepositoryInterface $allianceRepository,
35
        FactionRepositoryInterface $factionRepository,
36
        ShipRepositoryInterface $shipRepository
37
    ) {
38 1
        $this->userRepository = $userRepository;
39 1
        $this->allianceRepository = $allianceRepository;
40 1
        $this->factionRepository = $factionRepository;
41 1
        $this->shipRepository = $shipRepository;
42
    }
43
44
    public function createSystemScanPanel(
45
        ShipInterface $currentShip,
46
        UserInterface $user,
47
        LoggerUtilInterface $loggerUtil,
48
        StarSystemInterface $system
49
    ): SystemScanPanel {
50
        return new SystemScanPanel(
51
            $this,
52
            $this->shipRepository,
53
            $currentShip,
54
            $system,
55
            $user,
56
            $loggerUtil
57
        );
58
    }
59
60
    public function createSystemScanPanelEntry(
61
        VisualPanelEntryData $data,
62
        StarSystemInterface $system,
63
    ): SystemScanPanelEntry {
64
        return new SystemScanPanelEntry(
65
            $data,
66
            $system
67
        );
68
    }
69
70 1
    public function createDockingPrivilegeItem(
71
        DockingPrivilegeInterface $dockingPrivilege
72
    ): DockingPrivilegeItem {
73 1
        return new DockingPrivilegeItem(
74 1
            $this->userRepository,
75 1
            $this->allianceRepository,
76 1
            $this->factionRepository,
77 1
            $this->shipRepository,
78 1
            $dockingPrivilege
79 1
        );
80
    }
81
}
82