|
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
|
|
|
int $time = null |
|
80
|
|
|
): DatabaseTopListWithPoints { |
|
81
|
1 |
|
return new DatabaseTopListWithPoints( |
|
82
|
1 |
|
$this->userRepository, |
|
83
|
1 |
|
$userId, |
|
84
|
1 |
|
$points, |
|
85
|
1 |
|
$time |
|
86
|
1 |
|
); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
1 |
|
public function createDatabaseTopListFlights( |
|
90
|
|
|
array $item |
|
91
|
|
|
): DatabaseTopListFlights { |
|
92
|
1 |
|
return new DatabaseTopListFlights( |
|
93
|
1 |
|
$this->userRepository, |
|
94
|
1 |
|
$item |
|
95
|
1 |
|
); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function createDatabaseTopListWithColorGradient( |
|
99
|
|
|
int $userId, |
|
100
|
|
|
string $gradientColor |
|
101
|
|
|
): DatabaseTopListWithColorGradient { |
|
102
|
|
|
return new DatabaseTopListWithColorGradient( |
|
103
|
|
|
$this->userRepository, |
|
104
|
|
|
$userId, |
|
105
|
|
|
$gradientColor |
|
106
|
|
|
); |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|