public static function editorUri(
        string $file,
        int $line = null,
        string $action = 'open',
        string $search = '',
        string $replace = ''
    ): ?string {
        if (Debugger::$editor && $file && ($action === 'create' || is_file($file))) {
            $file = \str_replace('/', DIRECTORY_SEPARATOR, $file);
            $file = \strtr($file, Debugger::$editorMapping);

            return strtr(Debugger::$editor, [
                '%action' => $action,
                '%file' => rawurlencode($file),
                '%line' => $line ?: 1,
                '%search' => rawurlencode($search),
                '%replace' => rawurlencode($replace),
            ]);
        }

        return null;
    }