Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coding style #109

Merged
merged 3 commits into from
Jul 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/ObsAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,15 @@ private function extractExtraMetadata(array $metadata): array
$extracted = [];

foreach (self::EXTRA_METADATA_FIELDS as $field) {
if (isset($metadata[$field]) && $metadata[$field] !== '') {
$extracted[$field] = $metadata[$field];
if (! isset($metadata[$field])) {
continue;
}

if ($metadata[$field] === '') {
continue;
}

$extracted[$field] = $metadata[$field];
}

return $extracted;
Expand Down Expand Up @@ -467,7 +473,7 @@ protected function getObject(string $path): StreamInterface
public function listDirObjects(string $dirname = '', bool $recursive = false): array
{
$prefix = trim($this->pathPrefixer->prefixPath($dirname), '/');
$prefix = empty($prefix) ? '' : $prefix . '/';
$prefix = $prefix === '' ? '' : $prefix . '/';

$nextMarker = '';

Expand Down Expand Up @@ -511,7 +517,7 @@ public function listDirObjects(string $dirname = '', bool $recursive = false): a
private function processObjects(array $result, ?array $objects, string $dirname): array
{
$result['objects'] = [];
if (! empty($objects)) {
if ($objects !== null && $objects !== []) {
foreach ($objects as $object) {
$object['Prefix'] = $dirname;
$result['objects'][] = $object;
Expand All @@ -529,7 +535,7 @@ private function processObjects(array $result, ?array $objects, string $dirname)
*/
private function processPrefixes(array $result, ?array $prefixes): array
{
if (! empty($prefixes)) {
if ($prefixes !== null && $prefixes !== []) {
foreach ($prefixes as $prefix) {
$result['prefix'][] = $prefix['Prefix'];
}
Expand Down
Loading