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

Commit 6a1eaee

Browse files
committed
Renamed the data model into IdexView
1 parent ed896db commit 6a1eaee

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

share/templates/layout.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ function toggleVisible(head, row) {
186186
}
187187
}
188188
</script>
189-
<title><?php echo $dataModel->getPageTitle(); ?></title>
189+
<title><?php echo $view->pageTitle(); ?></title>
190190
</head>
191191

192192
<body>
193193
<div id="container">
194-
<h1><?php echo $dataModel->getPageTitle(); ?></h1>
194+
<h1><?php echo $view->pageTitle(); ?></h1>
195195

196196
<div class="tabs">
197197

@@ -200,7 +200,7 @@ function toggleVisible(head, row) {
200200
<label for="tab-status">Status</label>
201201
<div class="content">
202202
<table>
203-
<?php echo $dataModel->getStatusDataRows(); ?>
203+
<?php echo $view->getStatusDataRows(); ?>
204204
</table>
205205
</div>
206206
</div>
@@ -210,7 +210,7 @@ function toggleVisible(head, row) {
210210
<label for="tab-config">Configuration</label>
211211
<div class="content">
212212
<table>
213-
<?php foreach ($dataModel->getSettings() as $row): ?>
213+
<?php foreach ($view->getSettings() as $row): ?>
214214
<tr>
215215
<th><?php echo $row['config'] ?></th>
216216
<td><?php echo $row['value'] ?></td>
@@ -222,15 +222,15 @@ function toggleVisible(head, row) {
222222

223223
<div class="tab">
224224
<input type="radio" id="tab-scripts" name="tab-group-1">
225-
<label for="tab-scripts">Scripts (<?php echo $dataModel->getScriptStatusCount(); ?>)</label>
225+
<label for="tab-scripts">Scripts (<?php echo $view->getScriptStatusCount(); ?>)</label>
226226
<div class="content">
227227
<table style="font-size:0.8em;">
228228
<tr>
229229
<th width="10%">Hits</th>
230230
<th width="20%">Memory</th>
231231
<th width="70%">Path</th>
232232
</tr>
233-
<?php echo $dataModel->getScriptStatusRows(); ?>
233+
<?php echo $view->getScriptStatusRows(); ?>
234234
</table>
235235
</div>
236236
</div>
@@ -259,7 +259,7 @@ function toggleVisible(head, row) {
259259
<div id="partition"></div>
260260

261261
<script>
262-
var dataset = <?php echo $dataModel->getGraphDataSetJson(); ?>;
262+
var dataset = <?php echo $view->getGraphDataSetJson(); ?>;
263263

264264
var width = 400,
265265
height = 400,
@@ -293,10 +293,10 @@ function toggleVisible(head, row) {
293293
function set_text(t) {
294294
if (t === "memory") {
295295
d3.select("#stats").html(
296-
"<table><tr><th style='background:#B41F1F;'>Used</th><td><?php echo $dataModel->getHumanUsedMemory()?></td></tr>"+
297-
"<tr><th style='background:#1FB437;'>Free</th><td><?php echo $dataModel->getHumanFreeMemory()?></td></tr>"+
298-
"<tr><th style='background:#ff7f0e;' rowspan=\"2\">Wasted</th><td><?php echo $dataModel->getHumanWastedMemory()?></td></tr>"+
299-
"<tr><td><?php echo $dataModel->getWastedMemoryPercentage()?>%</td></tr></table>"
296+
"<table><tr><th style='background:#B41F1F;'>Used</th><td><?php echo $view->getHumanUsedMemory()?></td></tr>"+
297+
"<tr><th style='background:#1FB437;'>Free</th><td><?php echo $view->getHumanFreeMemory()?></td></tr>"+
298+
"<tr><th style='background:#ff7f0e;' rowspan=\"2\">Wasted</th><td><?php echo $view->getHumanWastedMemory()?></td></tr>"+
299+
"<tr><td><?php echo $view->getWastedMemoryPercentage()?>%</td></tr></table>"
300300
);
301301
} else if (t === "keys") {
302302
d3.select("#stats").html(
@@ -375,7 +375,7 @@ function format_value(value) {
375375
var partition = d3.layout.partition()
376376
.value(function(d) { return d.size; });
377377

378-
root = JSON.parse('<?php echo json_encode($dataModel->getD3Scripts()); ?>');
378+
root = JSON.parse('<?php echo json_encode($view->getD3Scripts()); ?>');
379379

380380
var g = vis.selectAll("g")
381381
.data(partition.nodes(root))

web/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
die("Module Zend OPcache is not loaded");
77
}
88

9-
class OpCacheDataModel
9+
class IndexView
1010
{
1111
private $configuration;
1212
private $status;
@@ -18,7 +18,7 @@ public function __construct()
1818
$this->status = opcache_get_status();
1919
}
2020

21-
public function getPageTitle()
21+
public function pageTitle()
2222
{
2323
return 'PHP ' . PHP_VERSION . " with OpCache {$this->configuration['version']['version']}";
2424
}
@@ -277,6 +277,6 @@ private function _arrayPset(&$array, $key, $value)
277277

278278
}
279279

280-
$dataModel = new OpCacheDataModel();
280+
$view = new IndexView();
281281

282282
include dirname(__DIR__) . '/share/templates/layout.php';

0 commit comments

Comments
 (0)