Skip to content

Commit

Permalink
Const MAX_KEYS
Browse files Browse the repository at this point in the history
  • Loading branch information
fogelito committed Sep 19, 2023
1 parent f7a7b6e commit 397afbb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Storage/Device.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ abstract public function getPartitionTotalSpace(): float;
/**
* Get all files and directories inside a directory.
*
* @param string $dir Directory to scan
* @param int $keys
* @param string $continuationToken
* @param string $dir Directory to scan
* @param int $keys
* @param string $continuationToken
* @return array<mixed>
*/
abstract public function getFiles(string $dir, int $keys = self::MAX_KEYS, string $continuationToken = ''): array;
Expand Down
15 changes: 8 additions & 7 deletions src/Storage/Device/S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ public function delete(string $path, bool $recursive = false): bool
*/
private function listObjects(string $prefix = '', int $maxKeys = self::MAX_KEYS, string $continuationToken = ''): array
{
if($maxKeys > self::MAX_KEYS){
throw new Exception('max-keys limit is ' . self::MAX_KEYS);
if ($maxKeys > self::MAX_KEYS) {
throw new Exception('max-keys limit is '.self::MAX_KEYS);
}

$uri = '/';
Expand All @@ -498,7 +498,7 @@ private function listObjects(string $prefix = '', int $maxKeys = self::MAX_KEYS,
'max-keys' => $maxKeys,
];

if (!empty($continuationToken)) {
if (! empty($continuationToken)) {
$parameters['continuation-token'] = $continuationToken;
}

Expand Down Expand Up @@ -664,9 +664,9 @@ public function getPartitionTotalSpace(): float
/**
* Get all files and directories inside a directory.
*
* @param string $dir Directory to scan
* @param int $keys
* @param string $continuationToken
* @param string $dir Directory to scan
* @param int $keys
* @param string $continuationToken
* @return array<mixed>
*
* @throws Exception
Expand All @@ -690,8 +690,9 @@ public function getFiles(string $dir, int $keys = self::MAX_KEYS, string $contin
/**
* Get file info
*
* @param string $path
* @param string $path
* @return array
*
* @throws Exception
*/
private function getInfo(string $path): array
Expand Down

0 comments on commit 397afbb

Please sign in to comment.