Skip to content
This repository was archived by the owner on Nov 27, 2022. It is now read-only.

Commit 5933d5f

Browse files
committed
Retrieved status is now an generator instead of an array
1 parent 6a1eaee commit 5933d5f

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

share/templates/layout.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@ function toggleVisible(head, row) {
200200
<label for="tab-status">Status</label>
201201
<div class="content">
202202
<table>
203-
<?php echo $view->getStatusDataRows(); ?>
203+
<?php foreach ($view->getStatus() as $row): ?>
204+
<tr>
205+
<th><?php echo $row['key'] ?></th>
206+
<td><?php echo $row['value'] ?></td>
207+
</tr>
208+
<?php endforeach ?>
204209
</table>
205210
</div>
206211
</div>

web/index.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ public function pageTitle()
2323
return 'PHP ' . PHP_VERSION . " with OpCache {$this->configuration['version']['version']}";
2424
}
2525

26-
public function getStatusDataRows()
26+
public function getStatus()
2727
{
28-
$rows = array();
2928
foreach ($this->status as $key => $value) {
3029
if ($key === 'scripts') {
3130
continue;
@@ -35,8 +34,7 @@ public function getStatusDataRows()
3534
foreach ($value as $k => $v) {
3635
if ($v === false) {
3736
$value = 'false';
38-
}
39-
if ($v === true) {
37+
} elseif ($v === true) {
4038
$value = 'true';
4139
}
4240
if ($k === 'used_memory' || $k === 'free_memory' || $k === 'wasted_memory') {
@@ -57,21 +55,17 @@ public function getStatusDataRows()
5755
if (THOUSAND_SEPARATOR === true && is_int($v)) {
5856
$value = number_format($v);
5957
}
60-
61-
$rows[] = "<tr><th>$k</th><td>$value</td></tr>\n";
58+
yield ["key" => $k, "value" => $value];
6259
}
6360
} else {
6461
if ($value === false) {
6562
$value = 'false';
66-
}
67-
if ($value === true) {
63+
} elseif ($value === true) {
6864
$value = 'true';
6965
}
70-
$rows[] = "<tr><th>$key</th><td>$value</td></tr>\n";
66+
yield ["key" => $key, "value" => $value];
7167
}
7268
}
73-
74-
return implode("\n", $rows);
7569
}
7670

7771
public function getSettings()

0 commit comments

Comments
 (0)