function printGetMetadataByPropertyId()

in analyticsdata/src/get_metadata_by_property_id.php [70:117]


function printGetMetadataByPropertyId(Metadata $response)
{
    // [START analyticsdata_print_get_metadata_response]
    foreach ($response->getDimensions() as $dimension) {
        print('DIMENSION' . PHP_EOL);
        printf(
            '%s (%s): %s' . PHP_EOL,
            $dimension->getApiName(),
            $dimension->getUiName(),
            $dimension->getDescription(),
        );
        printf(
            'custom definition: %s' . PHP_EOL,
            $dimension->getCustomDefinition() ? 'true' : 'false'
        );
        if ($dimension->getDeprecatedApiNames()->count() > 0) {
            print('Deprecated API names: ');
            foreach ($dimension->getDeprecatedApiNames() as $name) {
                print($name . ',');
            }
            print(PHP_EOL);
        }
        print(PHP_EOL);
    }

    foreach ($response->getMetrics() as $metric) {
        print('METRIC' . PHP_EOL);
        printf(
            '%s (%s): %s' . PHP_EOL,
            $metric->getApiName(),
            $metric->getUiName(),
            $metric->getDescription(),
        );
        printf(
            'custom definition: %s' . PHP_EOL,
            $metric->getCustomDefinition() ? 'true' : 'false'
        );
        if ($metric->getDeprecatedApiNames()->count() > 0) {
            print('Deprecated API names: ');
            foreach ($metric->getDeprecatedApiNames() as $name) {
                print($name . ',');
            }
            print(PHP_EOL);
        }
        print(PHP_EOL);
    }
    // [END analyticsdata_print_get_metadata_response]
}