Skip to content

Commit

Permalink
Merge pull request #16 from szepeviktor/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
XedinUnknown authored Oct 14, 2020
2 parents a10c73f + 0ae92e1 commit 927977f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/CachePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use function get_option;
use function get_transient;
use function set_transient;
use function array_map;

/**
* {@inheritDoc}
Expand Down Expand Up @@ -468,15 +469,9 @@ protected function selectColumn(string $query, string $columnName, array $args =
$query = $this->prepareQuery($query, $args);
$results = $this->wpdb->get_results($query, ARRAY_A);

$column = [];
foreach ($results as $row) {
$value = array_key_exists($columnName, $row)
? $row[$columnName]
: null;
$column[] = $value;
}

return $column;
return array_map(function ($row) use ($columnName) {
return $row[$columnName] ?? null;
}, $results);
}

/**
Expand Down

0 comments on commit 927977f

Please sign in to comment.