for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the sj-i/php-profiler package.
*
* (c) sji <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace PhpProfiler\Inspector\Output\TraceFormatter\Compat;
use PhpProfiler\Inspector\Output\TraceFormatter\CallTraceFormatter;
use PhpProfiler\Lib\PhpProcessReader\CallTrace;
final class CompatCallTraceFormatter implements CallTraceFormatter
{
private CompatCallFrameFormatter $call_frame_formatter;
private static ?self $cache;
public static function getInstance(): self
if (!isset(self::$cache)) {
self::$cache = new self(new CompatCallFrameFormatter());
}
return self::$cache;
return self::cache
null
PhpProfiler\Inspector\Ou...ompatCallTraceFormatter
public function __construct(
CompatCallFrameFormatter $call_frame_formatter
) {
$this->call_frame_formatter = $call_frame_formatter;
public function format(CallTrace $call_trace): string
$frames = [];
foreach ($call_trace->call_frames as $call_frame) {
$frames[] = $this->call_frame_formatter->format($call_frame);
return join(PHP_EOL, $frames);