-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
150 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Buggregator\Trap\Proto\Frame\Profiler; | ||
|
||
/** | ||
* @internal | ||
* @psalm-internal Buggregator | ||
*/ | ||
enum Type: string | ||
{ | ||
case XHProf = 'XHProf'; | ||
case XDebug = 'XDebug'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Buggregator\Trap\Sender\Console\Renderer; | ||
|
||
use Buggregator\Trap\Proto\Frame; | ||
use Buggregator\Trap\ProtoType; | ||
use Buggregator\Trap\Sender\Console\Renderer; | ||
use Buggregator\Trap\Sender\Console\Support\Common; | ||
use DateTimeImmutable; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* @implements Renderer<Frame\Profiler> | ||
* | ||
* @internal | ||
*/ | ||
final class Profiler implements Renderer | ||
{ | ||
public function isSupport(Frame $frame): bool | ||
{ | ||
return $frame->type === ProtoType::Profiler; | ||
} | ||
|
||
public function render(OutputInterface $output, Frame $frame): void | ||
{ | ||
\assert($frame instanceof Frame\Profiler); | ||
|
||
$subtitle = $frame->payload->type->value; | ||
Common::renderHeader1($output, 'PROFILER', $subtitle); | ||
|
||
$metadata = $frame->payload->getMetadata(); | ||
$data = []; | ||
isset($metadata['date']) && \is_numeric($metadata['date']) | ||
and $data['Time'] = new DateTimeImmutable('@' . $metadata['date']); | ||
isset($metadata['hostname']) and $data['Hostname'] = $metadata['hostname']; | ||
isset($metadata['filename']) and $data['File name'] = $metadata['filename']; | ||
|
||
Common::renderMetadata($output, $data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters