提交
This commit is contained in:
31
vendor/topthink/think-dumper/src/ServerDumper.php
vendored
Normal file
31
vendor/topthink/think-dumper/src/ServerDumper.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace think\dumper;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
use Symfony\Component\VarDumper\Dumper\DataDumperInterface;
|
||||
|
||||
class ServerDumper implements DataDumperInterface
|
||||
{
|
||||
protected Connection $connection;
|
||||
|
||||
protected ?DataDumperInterface $wrappedDumper;
|
||||
|
||||
public function __construct(?DataDumperInterface $wrappedDumper = null, array $contextProviders = [])
|
||||
{
|
||||
$this->connection = new Connection($contextProviders);
|
||||
$this->wrappedDumper = $wrappedDumper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function dump(Data $data)
|
||||
{
|
||||
if (!$this->connection->write($data) && $this->wrappedDumper) {
|
||||
return $this->wrappedDumper->dump($data);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user