$fields */ public static function append( string $requestId, string $event, array $fields, string $directory, bool $directoryWasResolved, string $checkpointId = '' ): void { if ($checkpointId === '') { $checkpointId = self::checkpointId(); ABJ_404_Solution_CheckpointIntentStore::append( ABJ_404_Solution_CheckpointRecordFactory::intent(array( 'request_id' => $requestId, 'event' => $event, 'checkpoint_id' => $checkpointId, 'hrtime_ns' => function_exists('hrtime') ? (int)hrtime(true) : null, 'pid' => ABJ_404_Solution_PhpRuntimeCapabilityAdapter::processId(), )) ); } if ($directory === '') { return; } if (!$directoryWasResolved && (!class_exists('ABJ_404_Solution_FileSystemService') || !ABJ_404_Solution_FileSystemService::createDirectoryWithErrorMessages($directory))) { return; } ABJ_404_Solution_CheckpointJournalWriter::append($directory, array_merge( $fields, ABJ_404_Solution_CheckpointRecordFactory::frequent(array( 'ts' => self::nowFloat(), 'hrtime_ns' => function_exists('hrtime') ? (int)hrtime(true) : null, 'request_id' => $requestId, 'event' => $event, 'checkpoint_id' => $checkpointId, 'pid' => ABJ_404_Solution_PhpRuntimeCapabilityAdapter::processId(), )) )); } private static function checkpointId(): string { self::$checkpointSequence++; $startedNs = function_exists('hrtime') ? (int)hrtime(true) : 0; return self::alphabeticHex( ABJ_404_Solution_PhpRuntimeCapabilityAdapter::processNumericToken() ) . '-' . self::alphabeticHex($startedNs) . '-f' . self::alphabeticHex(self::$checkpointSequence); } private static function alphabeticHex(int $value): string { return strtr(dechex($value), '0123456789abcdef', 'ghijklmnopqrstuv'); } private static function nowFloat(): ?float { if (function_exists('abj_clock')) { return abj_clock()->nowFloat(); } if (class_exists('ABJ_404_Solution_SystemClock')) { return (new ABJ_404_Solution_SystemClock())->nowFloat(); } return null; } }