<?php

declare(strict_types=1);

namespace Packetery\Tracy;

/**
 * @var \Throwable $ex
 * @var callable $dump
 */

if (!$ex instanceof \ErrorException || empty($ex->context) || !is_array($ex->context)) {
	return;
}
?>
<section class="tracy-section">
	<h2 class="tracy-section-label"><a href="#" data-tracy-ref="^+" class="tracy-toggle tracy-collapsed">Variables</a></h2>

	<div class="tracy-section-panel tracy-collapsed">
		<div class="tracy-pane">
			<table class="tracy-sortable">
<?php foreach ($ex->context as $k => $v): ?>
				<tr><th><?= Helpers::escapeHtml($k) ?></th><td><?= $dump($v, $k) ?></td></tr>
<?php endforeach ?>
			</table>
		</div>
	</div>
</section>
