-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathConsoleStatisticsEventOutput.php
More file actions
33 lines (26 loc) · 1.03 KB
/
ConsoleStatisticsEventOutput.php
File metadata and controls
33 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
declare(strict_types=1);
namespace Flowpack\DecoupledContentStore\Core\Infrastructure;
use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier;
use Neos\Flow\Cli\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
class ConsoleStatisticsEventOutput implements StatisticsEventOutputInterface
{
protected OutputInterface $output;
function __construct(OutputInterface $output)
{
$this->output = $output;
}
public static function fromConsoleOutput(ConsoleOutput $output): self
{
return static::fromSymfonyOutput($output->getOutput());
}
public static function fromSymfonyOutput(OutputInterface $output): self
{
return new static($output);
}
public function writeEvent(ContentReleaseIdentifier $contentReleaseIdentifier, string $prefix, string $event, array $additionalPayload): void
{
$this->output->writeln($prefix . 'STATISTICS EVENT ' . $event . ($additionalPayload ? ' ' . json_encode($additionalPayload) : ''));
}
}