private function buildVersion(SimpleXMLElement $version): array
    {
        $apis = [];
        $guides = [];
        foreach ($version->children() as $child) {
            switch ($child->getName()) {
                case 'api':
                    $apis[] = $this->buildApi($child);
                    break;
                case 'guide':
                    $guides[] = $this->buildGuide($child);
                    break;
                default:
                    break;
            }
        }

        $version = [
            'folder' => (string) $version->folder,
        ];

        if (count($apis) > 0) {
            $version['api'] = $apis;
        }

        if (count($guides) > 0) {
            $version['guide'] = $guides;
        }

        return $version;
    }
private function buildVersion(SimpleXMLElement $version): array
    {
        $apis = [];
        $guides = [];
        foreach ($version->children() as $child) {
            switch ($child->getName()) {
                case 'api':
                    $apis[] = $this->buildApi($child);
                    break;
                case 'guide':
                    $guides[] = $this->buildGuide($child);
                    break;
                default:
                    break;
            }
        }

        $version = [
            'folder' => (string) $version->folder,
        ];

        if (count($apis) > 0) {
            $version['api'] = $apis;
        }

        if (count($guides) > 0) {
            $version['guide'] = $guides;
        }

        return $version;
    }
private function buildVersion ( SimpleXMLElement $ version ) : array { $ apis = [ ] ; $ guides = [ ] ; foreach ( $ version -> children ( ) as $ child ) { switch ( $ child -> getName ( ) ) { case 'api' : $ apis [ ] = $ this -> buildApi ( $ child ) ; break ; case 'guide' : $ guides [ ] = $ this -> buildGuide ( $ child ) ; break ; default : break ; } } $ version = [ 'folder' => ( string ) $ version -> folder , ] ; if ( count ( $ apis ) > 0 ) { $ version [ 'api' ] = $ apis ; } if ( count ( $ guides ) > 0 ) { $ version [ 'guide' ] = $ guides ; } return $ version ; }
Builds the versions part of the array from the configuration xml.
Builds the versions part of the array from the configuration xml .