package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -21,8 +21,8 @@ use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
*/
class Connection
{
private $host;
private $contextProviders;
private string $host;
private array $contextProviders;
/**
* @var resource|null

View File

@@ -24,8 +24,8 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class DumpServer
{
private $host;
private $logger;
private string $host;
private ?LoggerInterface $logger;
/**
* @var resource|null
@@ -56,25 +56,19 @@ class DumpServer
}
foreach ($this->getMessages() as $clientId => $message) {
if ($this->logger) {
$this->logger->info('Received a payload from client {clientId}', ['clientId' => $clientId]);
}
$this->logger?->info('Received a payload from client {clientId}', ['clientId' => $clientId]);
$payload = @unserialize(base64_decode($message), ['allowed_classes' => [Data::class, Stub::class]]);
// Impossible to decode the message, give up.
if (false === $payload) {
if ($this->logger) {
$this->logger->warning('Unable to decode a message from {clientId} client.', ['clientId' => $clientId]);
}
$this->logger?->warning('Unable to decode a message from {clientId} client.', ['clientId' => $clientId]);
continue;
}
if (!\is_array($payload) || \count($payload) < 2 || !$payload[0] instanceof Data || !\is_array($payload[1])) {
if ($this->logger) {
$this->logger->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', ['clientId' => $clientId]);
}
$this->logger?->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', ['clientId' => $clientId]);
continue;
}