* @since 2.0 */ class RequestPanel extends Panel { public function getName() { return 'Request'; } public function getSummary() { $memory = sprintf('%.2fMB', $this->data['memory'] / 1048576); $time = sprintf('%.3fs', $this->data['time']); return << Peak memory: $memory
Time spent: $time
EOD; } public function getDetail() { return "

\$_GET

\n" . $this->renderTable($this->data['GET']) . "\n" . "

\$_POST

\n" . $this->renderTable($this->data['POST']) . "\n" . "

\$_COOKIE

\n" . $this->renderTable($this->data['COOKIE']) . "\n" . "

\$_FILES

\n" . $this->renderTable($this->data['FILES']) . "\n" . "

\$_SESSION

\n" . $this->renderTable($this->data['SESSION']) . "\n" . "

\$_SERVER

\n" . $this->renderTable($this->data['SERVER']); } public function save() { return array( 'memory' => memory_get_peak_usage(), 'time' => microtime(true) - YII_BEGIN_TIME, 'SERVER' => $_SERVER, 'GET' => $_GET, 'POST' => $_POST, 'COOKIE' => $_COOKIE, 'FILES' => empty($_FILES) ? array() : $_FILES, 'SESSION' => empty($_SESSION) ? array() : $_SESSION, ); } protected function renderTable($values) { $rows = array(); foreach ($values as $name => $value) { $rows[] = '' . Html::encode($name) . '
' . Html::encode(var_export($value, true)) . '
'; } if (!empty($rows)) { $rows = implode("\n", $rows); return << NameValue $rows EOD; } else { return 'Empty.'; } } }