LogBroadcaster::send()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 12
rs 9.9332
c 1
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Valkyrja Framework package.
7
 *
8
 * (c) Melech Mizrachi <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Valkyrja\Broadcast;
15
16
use JsonException;
17
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Valkyrja\Broadcast\Contract\Broadcaster as Contract;
19
use Valkyrja\Broadcast\Data\Contract\Message;
20
use Valkyrja\Log\Contract\Logger;
21
use Valkyrja\Type\BuiltIn\Support\Arr;
22
23
/**
24
 * Class LogBroadcaster.
25
 *
26
 * @author Melech Mizrachi
27
 */
28
class LogBroadcaster implements Contract
29
{
30
    /**
31
     * LogBroadcaster constructor.
32
     */
33
    public function __construct(
34
        protected Logger $logger
35
    ) {
36
    }
37
38
    /**
39
     * @inheritDoc
40
     *
41
     * @throws JsonException
42
     */
43
    #[Override]
44
    public function send(Message $message): void
45
    {
46
        $this->logger->info(static::class . ' Send');
47
        $this->logger->info('Channel:');
48
        $this->logger->info($message->getChannel());
49
        $this->logger->info('Event:');
50
        $this->logger->info($message->getEvent());
51
        $this->logger->info('Data:');
52
        $this->logger->info(Arr::toString($message->getData() ?? []));
53
        $this->logger->info('Message:');
54
        $this->logger->info($message->getMessage());
55
    }
56
}
57