<?php namespace Spatie\FlareClient; use Symfony\Component\VarDumper\Cloner\VarCloner; use Symfony\Component\VarDumper\Dumper\HtmlDumper; class View { protected string $file; /** @var array<string, mixed> */ protected array $data = []; /** * @param string $file * @param array<string, mixed> $data */ public function __construct(string $file, array $data = []) { $this->file = $file; $this->data = $data; } /** * @param string $file * @param array<string, mixed> $data * * @return self */ public static function create(string $file, array $data = []): self { return new self($file, $data); } protected function dumpViewData(mixed $variable): string { $cloner = new VarCloner(); $dumper = new HtmlDumper(); $dumper->setDumpHeader(''); $output = fopen('php://memory', 'r+b'); if (! $output) { return ''; } $dumper->dump($cloner->cloneVar($variable)->withMaxDepth(1), $output, [ 'maxDepth' => 1, 'maxStringLength' => 160, ]); return (string)stream_get_contents($output, -1, 0); } /** @return array<string, mixed> */ public function toArray(): array { return [ 'file' => $this->file, 'data' => array_map([$this, 'dumpViewData'], $this->data), ]; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Concerns | Folder | 0755 |
|
|
Context | Folder | 0755 |
|
|
Contracts | Folder | 0755 |
|
|
Enums | Folder | 0755 |
|
|
FlareMiddleware | Folder | 0755 |
|
|
Glows | Folder | 0755 |
|
|
Http | Folder | 0755 |
|
|
Solutions | Folder | 0755 |
|
|
Time | Folder | 0755 |
|
|
Truncation | Folder | 0755 |
|
|
Api.php | File | 1.82 KB | 0644 |
|
Flare.php | File | 10.98 KB | 0644 |
|
Frame.php | File | 735 B | 0644 |
|
Report.php | File | 8.95 KB | 0644 |
|
View.php | File | 1.41 KB | 0644 |
|
helpers.php | File | 678 B | 0644 |
|