src/MetadataParser.php
/**
     * Parse metadata from different file formats
     * 
     * @param string $raw SwissMetNet metadata string from text file or CSV
     * @return stdClass $metadata[array locations, array parameters]
     */
Parse metadata from different file formats

@param string $raw SwissMetNet metadata string from text file or CSV
@return stdClass $metadata[array locations, array parameters]
Parse metadata from different file formats @param string $raw SwissMetNet metadata string from text file or CSV @return stdClass $metadata [ array locations array parameters ]
public static function parse(string $raw)
    {
        $metadata = new \stdClass();
        $metadata->locations = [];
        $metadata->parameters = [];
        $metadataFromTextFile = self::parseFromTextFile($raw);
        $metadataFromCsvFile = self::parseFromCsvFile($raw);
        $metadata->locations = array_merge($metadataFromTextFile->locations, $metadataFromCsvFile->locations);
        $metadata->parameters = array_merge($metadataFromTextFile->parameters, $metadataFromCsvFile->parameters);
        return $metadata;
    }
public static function parse ( string $ raw ) { $ metadata = new \ stdClass ( ) ; $ metadata -> locations = [ ] ; $ metadata -> parameters = [ ] ; $ metadataFromTextFile = self :: parseFromTextFile ( $ raw ) ; $ metadataFromCsvFile = self :: parseFromCsvFile ( $ raw ) ; $ metadata -> locations = array_merge ( $ metadataFromTextFile -> locations , $ metadataFromCsvFile -> locations ) ; $ metadata -> parameters = array_merge ( $ metadataFromTextFile -> parameters , $ metadataFromCsvFile -> parameters ) ; return $ metadata ; }
Parse metadata from different file formats
Parse metadata from different file formats