$existing * @param array $result */ public static function markerId( string $position, string $hook, int $priority, string $id, array $existing, array $result ): string { $base = 'abj404-trace-' . $position . '-' . substr(hash('sha256', $hook . '|' . $priority . '|' . $id), 0, 16); $candidate = $base; $suffix = 0; while (array_key_exists($candidate, $existing) || array_key_exists($candidate, $result)) { $suffix++; $candidate = $base . '-' . $suffix; } return $candidate; } }