Passed
Pull Request — master (#225)
by Dmitriy
02:30
created

VarDumperHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\DebugServer;
6
7
use Yiisoft\VarDumper\HandlerInterface;
8
use Yiisoft\VarDumper\VarDumper;
9
10
final class VarDumperHandler implements HandlerInterface
11
{
12
    public Connection $connection;
13
14
    public function __construct()
15
    {
16
        $this->connection = Connection::create();
17
    }
18
19
    public function handle(mixed $variable, int $depth, bool $highlight = false): void
20
    {
21
        $this->connection->broadcast(Connection::MESSAGE_TYPE_VAR_DUMPER, VarDumper::create($variable)->asJson(false));
22
    }
23
}
24