implement DRY principle (#6553)

This commit is contained in:
Prajwol Amatya
2023-06-28 10:56:08 +05:45
committed by GitHub
parent 73d48b1132
commit 0b67887e29
8 changed files with 221 additions and 603 deletions
@@ -3712,38 +3712,6 @@ trait WebDav {
}
}
/**
* Old style chunking upload
*
* @Given user :user has uploaded the following :total chunks to :file with old chunking
*
* @param string $user
* @param string $total
* @param string $file
* @param TableNode $chunkDetails table of 2 columns, chunk number and chunk
* content with following headings, e.g.
* | number | content |
* | 1 | first data |
* | 2 | followed by second data |
* Chunks may be numbered out-of-order if desired.
*
* @return void
* @throws Exception
*/
public function userHasUploadedTheFollowingTotalChunksUsingOldChunking(
string $user,
string $total,
string $file,
TableNode $chunkDetails
):void {
$this->verifyTableNodeColumns($chunkDetails, ['number', 'content']);
foreach ($chunkDetails->getHash() as $chunkDetail) {
$chunkNumber = (int) $chunkDetail['number'];
$chunkContent = $chunkDetail['content'];
$this->userHasUploadedChunkedFile($user, $chunkNumber, (int) $total, $chunkContent, $file);
}
}
/**
* Old style chunking upload
*
@@ -3775,37 +3743,6 @@ trait WebDav {
);
}
/**
* Old style chunking upload
*
* @Given user :user has uploaded the following chunks to :file with old chunking
*
* @param string $user
* @param string $file
* @param TableNode $chunkDetails table of 2 columns, chunk number and chunk
* content with headings, e.g.
* | number | content |
* | 1 | first data |
* | 2 | followed by second data |
* Chunks may be numbered out-of-order if desired.
*
* @return void
* @throws Exception
*/
public function userHasUploadedTheFollowingChunksUsingOldChunking(
string $user,
string $file,
TableNode $chunkDetails
):void {
$total = \count($chunkDetails->getRows());
$this->userHasUploadedTheFollowingTotalChunksUsingOldChunking(
$user,
(string) $total,
$file,
$chunkDetails
);
}
/**
* Old style chunking upload
*