private function buildApi(SimpleXMLElement $api): array
    {
        $extensions = [];
        foreach ($api->extensions->children() as $extension) {
            if ((string) $extension !== '') {
                $extensions[] = (string) $extension;
            }
        }

        $ignoreHidden = filter_var($api->ignore->attributes()->hidden, FILTER_VALIDATE_BOOLEAN);

        return [
            'format' => ((string) $api->attributes()->format) ?: 'php',
            'source' => [
                'dsn' => ((string) $api->source->attributes()->dsn) ?: 'file://.',
                'paths' => ((array) $api->source->path) ?: ['.'],
            ],
            'ignore' => [
                'hidden' => $ignoreHidden,
                'paths' => (array) $api->ignore->path,
            ],
            'extensions' => $extensions,
            'visibility' => (array) $api->visibility,
            'default-package-name' => ((string) $api->{'default-package-name'}) ?: 'Default',
            'markers' => (array) $api->markers->children()->marker,
        ];
    }