1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Module\Database\Lib; |
6
|
|
|
|
7
|
|
|
use Stu\Orm\Repository\ColonyRepositoryInterface; |
8
|
|
|
use Stu\Orm\Repository\CommodityRepositoryInterface; |
9
|
|
|
use Stu\Orm\Repository\ShipRepositoryInterface; |
10
|
|
|
use Stu\Orm\Repository\TradePostRepositoryInterface; |
11
|
|
|
use Stu\Orm\Repository\UserRepositoryInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Create ui items related for database views |
15
|
|
|
*/ |
16
|
|
|
final class DatabaseUiFactory implements DatabaseUiFactoryInterface |
17
|
|
|
{ |
18
|
|
|
private CommodityRepositoryInterface $commodityRepository; |
19
|
|
|
|
20
|
|
|
private ShipRepositoryInterface $shipRepository; |
21
|
|
|
|
22
|
|
|
private ColonyRepositoryInterface $colonyRepository; |
23
|
|
|
|
24
|
|
|
private TradePostRepositoryInterface $tradePostRepository; |
25
|
|
|
|
26
|
|
|
private UserRepositoryInterface $userRepository; |
27
|
|
|
|
28
|
5 |
|
public function __construct( |
29
|
|
|
CommodityRepositoryInterface $commodityRepository, |
30
|
|
|
ShipRepositoryInterface $shipRepository, |
31
|
|
|
ColonyRepositoryInterface $colonyRepository, |
32
|
|
|
UserRepositoryInterface $userRepository, |
33
|
|
|
TradePostRepositoryInterface $tradePostRepository |
34
|
|
|
) { |
35
|
5 |
|
$this->commodityRepository = $commodityRepository; |
36
|
5 |
|
$this->shipRepository = $shipRepository; |
37
|
5 |
|
$this->colonyRepository = $colonyRepository; |
38
|
5 |
|
$this->tradePostRepository = $tradePostRepository; |
39
|
5 |
|
$this->userRepository = $userRepository; |
40
|
|
|
} |
41
|
|
|
|
42
|
1 |
|
public function createStorageWrapper( |
43
|
|
|
int $commodityId, |
44
|
|
|
int $amount, |
45
|
|
|
?int $entityId = null |
46
|
|
|
): StorageWrapper { |
47
|
1 |
|
return new StorageWrapper( |
48
|
1 |
|
$this->commodityRepository, |
49
|
1 |
|
$this->shipRepository, |
50
|
1 |
|
$this->colonyRepository, |
51
|
1 |
|
$this->tradePostRepository, |
52
|
1 |
|
$commodityId, |
53
|
1 |
|
$amount, |
54
|
1 |
|
$entityId |
55
|
1 |
|
); |
56
|
|
|
} |
57
|
|
|
|
58
|
1 |
|
public function createDatabaseTopActivTradePost( |
59
|
|
|
array $item |
60
|
|
|
): DatabaseTopActivTradePost { |
61
|
1 |
|
return new DatabaseTopActivTradePost( |
62
|
1 |
|
$this->userRepository, |
63
|
1 |
|
$item |
64
|
1 |
|
); |
65
|
|
|
} |
66
|
|
|
|
67
|
1 |
|
public function createDatabaseTopListCrew( |
68
|
|
|
array $item |
69
|
|
|
): DatabaseTopListCrew { |
70
|
1 |
|
return new DatabaseTopListCrew( |
71
|
1 |
|
$this->userRepository, |
72
|
1 |
|
$item |
73
|
1 |
|
); |
74
|
|
|
} |
75
|
|
|
|
76
|
1 |
|
public function createDatabaseTopListWithPoints( |
77
|
|
|
int $userId, |
78
|
|
|
string $points |
79
|
|
|
): DatabaseTopListWithPoints { |
80
|
1 |
|
return new DatabaseTopListWithPoints( |
81
|
1 |
|
$this->userRepository, |
82
|
1 |
|
$userId, |
83
|
1 |
|
$points |
84
|
1 |
|
); |
85
|
|
|
} |
86
|
|
|
|
87
|
1 |
|
public function createDatabaseTopListFlights( |
88
|
|
|
array $item |
89
|
|
|
): DatabaseTopListFlights { |
90
|
1 |
|
return new DatabaseTopListFlights( |
91
|
1 |
|
$this->userRepository, |
92
|
1 |
|
$item |
93
|
1 |
|
); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|