@@ -116,13 +116,13 @@ public function addToCreatedPublicShares(SimpleXMLElement $shareData): void {
116
116
* @return void
117
117
*/
118
118
public function shareNgAddToCreatedLinkShares (ResponseInterface $ response ): void {
119
- $ this ->shareNgCreatedLinkShares [] = $ response ;
119
+ $ this ->shareNgCreatedLinkShares [] = $ this -> getJsonDecodedResponse ( $ response) ;
120
120
}
121
121
122
122
/**
123
- * @return ResponseInterface |null
123
+ * @return array |null
124
124
*/
125
- public function shareNgGetLastCreatedLinkShare (): ?ResponseInterface {
125
+ public function shareNgGetLastCreatedLinkShare (): ?array {
126
126
return \end ($ this ->shareNgCreatedLinkShares );
127
127
}
128
128
@@ -132,13 +132,13 @@ public function shareNgGetLastCreatedLinkShare(): ?ResponseInterface {
132
132
* @return void
133
133
*/
134
134
public function shareNgAddToCreatedUserGroupShares (ResponseInterface $ response ): void {
135
- $ this ->shareNgCreatedUserGroupShares [] = $ response ;
135
+ $ this ->shareNgCreatedUserGroupShares [] = $ this -> getJsonDecodedResponse ( $ response) ;
136
136
}
137
137
138
138
/**
139
- * @return ResponseInterface |null
139
+ * @return array |null
140
140
*/
141
- public function shareNgGetLastCreatedUserGroupShare (): ?ResponseInterface {
141
+ public function shareNgGetLastCreatedUserGroupShare (): ?array {
142
142
return \end ($ this ->shareNgCreatedUserGroupShares );
143
143
}
144
144
@@ -201,37 +201,68 @@ public function getSharesEndpointPath(?string $postfix = ''): string {
201
201
*/
202
202
public function shareNgGetLastCreatedLinkShareID (): string {
203
203
$ lastResponse = $ this ->shareNgGetLastCreatedLinkShare ();
204
- if (!isset ($ this -> getJsonDecodedResponse ( $ lastResponse) ['id ' ])) {
204
+ if (!isset ($ lastResponse ['id ' ])) {
205
205
throw new Error ('Response did not contain share id for the created public link ' );
206
206
}
207
- return $ this -> getJsonDecodedResponse ( $ lastResponse) ['id ' ];
207
+ return $ lastResponse ['id ' ];
208
208
}
209
209
210
210
/**
211
211
* @return string
212
212
*/
213
213
public function shareNgGetLastCreatedLinkShareToken (): string {
214
214
$ lastResponse = $ this ->shareNgGetLastCreatedLinkShare ();
215
- if (!isset ($ this -> getJsonDecodedResponse ( $ lastResponse) ['link ' ]['webUrl ' ])) {
215
+ if (!isset ($ lastResponse ['link ' ]['webUrl ' ])) {
216
216
throw new Error (
217
217
'Response did not contain share id '
218
- . $ this -> getJsonDecodedResponse ( $ lastResponse) ['link ' ]['webUrl ' ]
218
+ . $ lastResponse ['link ' ]['webUrl ' ]
219
219
. ' for the created public link '
220
220
);
221
221
}
222
- $ last_created_link_webURL = $ this ->getJsonDecodedResponse ($ lastResponse )['link ' ]['webUrl ' ];
223
- return substr (strrchr ($ last_created_link_webURL , "/ " ), 1 );
222
+ return substr (strrchr ($ lastResponse ['link ' ]['webUrl ' ], "/ " ), 1 );
223
+ }
224
+
225
+ /**
226
+ * @param string $permissionId
227
+ * @param ResponseInterface $response
228
+ *
229
+ * @return void
230
+ */
231
+ public function shareNgUpdatedCreatedLinkShare (string $ permissionId , ResponseInterface $ response ): void {
232
+ foreach ($ this ->shareNgCreatedLinkShares as $ key => $ share ) {
233
+ if ($ share ['id ' ] === $ permissionId ) {
234
+ $ decodedResponse = $ this ->getJsonDecodedResponse ($ response );
235
+ $ this ->shareNgCreatedLinkShares [$ key ] = $ decodedResponse ;
236
+ return ;
237
+ }
238
+ }
224
239
}
225
240
226
241
/**
227
242
* @return string
228
243
*/
229
244
public function shareNgGetLastCreatedUserGroupShareID (): string {
230
245
$ lastResponse = $ this ->shareNgGetLastCreatedUserGroupShare ();
231
- if (!isset ($ this -> getJsonDecodedResponse ( $ lastResponse) ['value ' ][0 ]['id ' ])) {
246
+ if (!isset ($ lastResponse ['value ' ][0 ]['id ' ])) {
232
247
throw new Error ('Response did not contain share id for the last created share. ' );
233
248
}
234
- return $ this ->getJsonDecodedResponse ($ lastResponse )['value ' ][0 ]['id ' ];
249
+ return $ lastResponse ['value ' ][0 ]['id ' ];
250
+ }
251
+
252
+ /**
253
+ * @param string $permissionId
254
+ * @param ResponseInterface $response
255
+ *
256
+ * @return void
257
+ */
258
+ public function shareNgUpdateCreatedUserGroupShare (string $ permissionId , ResponseInterface $ response ): void {
259
+ foreach ($ this ->shareNgCreatedUserGroupShares as $ key => $ share ) {
260
+ if ($ share ['value ' ][0 ]['id ' ] === $ permissionId ) {
261
+ $ decodedResponse = $ this ->getJsonDecodedResponse ($ response );
262
+ $ this ->shareNgCreatedUserGroupShares [$ key ]['value ' ] = $ decodedResponse ;
263
+ return ;
264
+ };
265
+ }
235
266
}
236
267
237
268
/**
0 commit comments