| Total Complexity | 4 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class TraceIdProcessor implements ProcessorInterface |
||
| 9 | { |
||
| 10 | private ?string $traceId = null; |
||
| 11 | |||
| 12 | public function __invoke(array $records): array |
||
| 13 | { |
||
| 14 | $records['trace_id'] = $this->getTraceId(); |
||
| 15 | return $records; |
||
| 16 | } |
||
| 17 | |||
| 18 | private function getTraceId(): string |
||
| 19 | { |
||
| 20 | if ($this->traceId !== null) { |
||
| 21 | return $this->traceId; |
||
| 22 | } |
||
| 23 | |||
| 24 | $this->traceId = OpenCensusHelper::traceId(); |
||
| 25 | return $this->traceId; |
||
|
|
|||
| 26 | } |
||
| 27 | |||
| 28 | public function setTraceId(?string $traceId): void |
||
| 31 | } |
||
| 32 | } |
||
| 33 |