<?php
declare(strict_types=1);

/**
 * @var \Magento\Framework\View\Element\Template $block
 * @var \Magento\Framework\Escaper $escaper
 * @var \ClawRock\Debug\Model\Collector\ConfigCollector $collector
 */
$collector = $block->getCollector();
?>
<div class="
    sf-toolbar-block
    sf-toolbar-block-<?= /* @noEscape */ $collector->getName() ?>
    sf-toolbar-status-normal
    sf-toolbar-block-right
">
    <a target="_blank" href="<?= $escaper->escapeUrl($block->getProfilerUrl()); ?>">
        <div class="sf-toolbar-icon">
            <img src="<?= /* @noEscape */ $block->getViewFileUrl('ClawRock_Debug::images/collector/config.svg'); ?>"
                 alt="<?= $escaper->escapeHtmlAttr(__('Config')) ?>"/>
            <span class="sf-toolbar-value"><?= /* @noEscape */ $collector->getVersion() ?></span>
        </div>
    </a>
    <div class="sf-toolbar-info">
        <div class="sf-toolbar-info-group">
            <div class="sf-toolbar-info-piece">
                <strong><?= $escaper->escapeHtml(__('Website')); ?></strong>
                <span>
                    <?= /* @noEscape */ $collector->getWebsiteName() ?>
                    (<?= /* @noEscape */ $collector->getWebsiteCode() ?>)
                </span>
            </div>
            <div class="sf-toolbar-info-piece">
                <strong><?= $escaper->escapeHtml(__('Store')); ?></strong>
                <span>
                    <?= /* @noEscape */ $collector->getStoreName() ?>
                    (<?= /* @noEscape */ $collector->getStoreCode() ?>)
                </span>
            </div>
            <div class="sf-toolbar-info-piece">
                <strong><?= $escaper->escapeHtml(__('Profiler token')); ?></strong>
                <span>
                    <a href="<?= $escaper->escapeUrl($collector->getProfilerUrl()) ?>">
                        <?= /* @noEscape */ $collector->getToken()?>
                    </a>
                </span>
            </div>
            <div class="sf-toolbar-info-piece">
                <strong><?= $escaper->escapeHtml(__('Admin')); ?></strong>
                <span>
                    <a href="<?= $escaper->escapeUrl($collector->getAdminUrl()); ?>">
                        <?= $escaper->escapeHtml(__('Dashboard')); ?>
                    </a>
                    <a href="<?= $escaper->escapeUrl($collector->getConfigurationUrl()); ?>">
                        <?= $escaper->escapeHtml(__('Configuration')); ?>
                    </a>
                </span>
            </div>
            <div class="sf-toolbar-info-piece">
                <strong><?= $escaper->escapeHtml(__('Developer mode')); ?></strong>
                <span>
                    <?= $escaper->escapeHtml($collector->isDeveloperMode() ? __('on') : __('off')); ?>
                </span>
            </div>
        </div>
        <div class="sf-toolbar-info-group">
            <div class="sf-toolbar-info-piece sf-toolbar-info-php">
                <strong><?= $escaper->escapeHtml(__('PHP version')); ?></strong>
                <span>
                    <?= /* @noEscape */ $collector->getPHPVersion() ?>
                    <a href="<?= $escaper->escapeUrl($block->getUrl('_debug/profiler/phpinfo')) ?>">phpinfo()</a>
                </span>
            </div>
            <div class="sf-toolbar-info-piece sf-toolbar-info-php-ext">
                <strong><?= $escaper->escapeHtml(__('PHP Extensions')); ?></strong>
                <span class="
                    sf-toolbar-status
                    sf-toolbar-status-<?= /* @noEscape */ $collector->hasXDebug() ? 'green' : 'red' ?>
                ">
                    Xdebug
                </span>
                <span class="
                    sf-toolbar-status
                    sf-toolbar-status-<?= /* @noEscape */ $collector->hasAccelerator() ? 'green' : 'red' ?>
                ">
                    <?= $escaper->escapeHtml(__('accel')); ?>
                </span>
            </div>
            <div class="sf-toolbar-info-piece">
                <strong>PHP SAPI</strong>
                <span><?= /* @noEscape */ $collector->getPHPSAPI() ?></span>
            </div>
        </div>
    </div>
</div>
