protected function writeExtensions(\XMLWriter $xmlWriter, array $extensions)
    {
        $xmlWriter->startElement('extensions');
        foreach ($extensions as $extension) {
            switch ($extension::ID()) {
                case HR::ID():
                    $xmlWriter->startElementNs('gpxtpx', 'TrackPointExtension', null);
                    $xmlWriter->writeElementNs('gpxtpx', 'hr', null, (string)$extension->value());
                    $xmlWriter->endElement();
                    break;
            }
        }
        $xmlWriter->endElement();
    }