@@ -20,22 +20,22 @@ public function __construct(
20
20
}
21
21
22
22
/** @return array<Split> */
23
- public function getAll (User $ user , bool $ withRemainder = false ):array {
23
+ public function getAll (User $ user , ? string $ remainderName = null ):array {
24
24
$ splitList = [];
25
25
26
26
$ resultSet = $ this ->db ->fetchAll ("getAll " , $ user ->id );
27
27
foreach ($ resultSet as $ row ) {
28
28
array_push (
29
29
$ splitList ,
30
- $ this ->rowToSplit ($ row , withRemainderSplitPercentage : $ withRemainder ),
30
+ $ this ->rowToSplit ($ row , remainderName : $ remainderName ),
31
31
);
32
32
}
33
33
34
34
return $ splitList ;
35
35
}
36
36
37
37
/** @return array<SplitPercentage> */
38
- public function getSplitPercentageList (User $ user , string $ splitId , bool $ withRemainderSplitPercentage = false ):array {
38
+ public function getSplitPercentageList (User $ user , string $ splitId , ? string $ remainderName = null ):array {
39
39
$ resultSet = $ this ->db ->fetchAll ("getSplitPercentageList " , $ splitId , $ user ->id );
40
40
41
41
$ splitPercentageList = [];
@@ -46,8 +46,8 @@ public function getSplitPercentageList(User $user, string $splitId, bool $withRe
46
46
);
47
47
}
48
48
49
- if ($ withRemainderSplitPercentage ) {
50
- array_push ($ splitPercentageList , new RemainderSplitPercentage ($ splitPercentageList ));
49
+ if ($ remainderName ) {
50
+ array_push ($ splitPercentageList , new RemainderSplitPercentage ($ splitPercentageList, $ remainderName ));
51
51
}
52
52
return $ splitPercentageList ;
53
53
}
@@ -94,7 +94,7 @@ public function delete(string $splitId, User $user):void {
94
94
$ this ->db ->delete ("delete " , $ splitId , $ user ->id );
95
95
}
96
96
97
- private function rowToSplit (?Row $ row , ?User $ user = null , bool $ withRemainderSplitPercentage = false ):?Split {
97
+ private function rowToSplit (?Row $ row , ?User $ user = null , ? string $ remainderName = null ):?Split {
98
98
if (!$ row ) {
99
99
return null ;
100
100
}
@@ -103,7 +103,7 @@ private function rowToSplit(?Row $row, ?User $user = null, bool $withRemainderSp
103
103
$ user = $ user ?? $ this ->userRepository ->getById ($ row ->getString ("userId " ));
104
104
$ product = $ this ->productRepository ->getById ($ row ->getString ("productId " ));
105
105
106
- $ splitPercentageList = $ this ->getSplitPercentageList ($ user , $ id , $ withRemainderSplitPercentage );
106
+ $ splitPercentageList = $ this ->getSplitPercentageList ($ user , $ id , $ remainderName );
107
107
108
108
return new Split (
109
109
$ id ,
0 commit comments