ecoco/magento_profiler

View on GitHub
app/design/frontend/base/default/template/ecocode_profiler/renderer/call-stack.phtml

Summary

Maintainability
Test Coverage
<?php
/** @var Ecocode_Profiler_Block_Renderer_CallStack $this */

/** @var Ecocode_Profiler_Helper_Code $codeHelper */
$codeHelper = Mage::helper('ecocode_profiler/code');


$trace = $this->getStack();
?>
<?php if ($trace): ?>
    <?php if ($this->shouldWarp()): ?>
        <div id="stack-<?php echo $this->getStackId() ?>" class="hidden">
        <strong class="font-normal text-small">Trace:</strong>
    <?php endif ?>
        <ul class="sf-call-stack ">
            <?php foreach ($trace as $call): ?>
                <?php
                $from = '-';
                if (isset($call['class'])) {
                    $from = $codeHelper->abbrClass($call['class']) . '::' . $codeHelper->abbrMethod($call['function']);
                } elseif (isset($call['function'])) {
                    $from = $codeHelper->abbrMethod($call['function']);
                } elseif (isset($call['file'])) {
                    $from = $call['file'];
                }

                $fileName = null;
                if (isset($call['file'], $call['line'])) {
                    $fileName = str_replace('\\', '/', $call['file']);
                    $fileName = explode('/', $fileName);
                    $fileName = end($fileName);
                }
                ?>

                <li>
                    <?php echo $from; ?>
                    <?php if ($fileName): ?>
                        <span class="text-small">
                            (called from <?php echo $codeHelper->formatFile($call['file'], $call['line'], $fileName) ?>)
                        </span>
                    <?php endif; ?>
                </li>
            <?php endforeach; ?>
        </ul>

    <?php if ($this->shouldWarp()): ?>
        </div>
    <?php endif ?>
<?php endif; ?>