Skip to content

Commit

Permalink
Fix coding style (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingimmick authored Jul 15, 2023
1 parent dd1d407 commit 81e0598
Showing 1 changed file with 11 additions and 5 deletions.
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

0 comments on commit 81e0598

Please sign in to comment.