Skip to content

Commit ae81556

Browse files
committed
fixes
1 parent e6c8e31 commit ae81556

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

src/Dashboards/Redis/Compatibility/Cluster/PredisCluster.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@ public function getInfo(?string $option = null, ?array $combine = null): array {
9898
try {
9999
$response = $node->info($section_name);
100100

101-
$node_section_info = (is_array($response) && !empty($response)) ? reset($response) : null;
101+
$node_section_info = (is_array($response) && $response !== []) ? reset($response) : null;
102+
if (!$node_section_info) {
103+
continue;
104+
}
102105

103-
if (!$node_section_info || !is_array($node_section_info)) {
106+
if (!is_array($node_section_info)) {
104107
continue;
105108
}
106109

src/Dashboards/Redis/Compatibility/Predis.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function getInfo(?string $option = null): array {
7979
foreach ($this->getInfoSections() as $section) {
8080
$response = $this->info($section);
8181

82-
$section_data = (is_array($response) && !empty($response)) ? reset($response) : null;
82+
$section_data = (is_array($response) && $response !== []) ? reset($response) : null;
8383

8484
if ($section_data && is_array($section_data)) {
8585
if ($section === 'keyspace') {
@@ -96,6 +96,7 @@ public function getInfo(?string $option = null): array {
9696

9797
$reformatted_keyspace[$db] = implode(',', $key_value_pairs);
9898
}
99+
99100
$section_data = $reformatted_keyspace;
100101
}
101102

src/Dashboards/Redis/Compatibility/RedisExtra.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,17 @@ public function getInfoSections(): array {
2222
}
2323

2424
/**
25-
* @return array<int, array<string, mixed>>
25+
* @return array<string, array<string, mixed>>
2626
*/
2727
public function parseSectionData(string $section): array {
28-
$data = $this->getInfo($section);
29-
30-
return array_map(static function ($value) {
31-
if (is_array($value)) {
32-
return $value;
33-
}
28+
/** @var array<string, string> $info */
29+
$info = $this->getInfo($section);
3430

31+
return array_map(static function (string $value): array {
3532
parse_str(str_replace(',', '&', $value), $parsed);
3633

3734
return $parsed;
38-
}, $data);
35+
}, $info);
3936
}
4037

4138
/**

0 commit comments

Comments
 (0)