65c1b5fb75
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
36 lines
773 B
PHP
36 lines
773 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KTXC\Application\Execution;
|
|
|
|
final readonly class ExecutionDescriptor
|
|
{
|
|
public function __construct(
|
|
public RuntimeType $runtime,
|
|
public string $executionId,
|
|
public string $correlationId,
|
|
public ?string $operationName = null,
|
|
) {
|
|
}
|
|
|
|
public static function http(?string $operationName = null): self
|
|
{
|
|
$id = self::id();
|
|
|
|
return new self(RuntimeType::HTTP, $id, $id, $operationName);
|
|
}
|
|
|
|
public static function cli(?string $operationName = null): self
|
|
{
|
|
$id = self::id();
|
|
|
|
return new self(RuntimeType::CLI, $id, $id, $operationName);
|
|
}
|
|
|
|
private static function id(): string
|
|
{
|
|
return bin2hex(random_bytes(16));
|
|
}
|
|
}
|