查询Google Search Console API PHP

I am querying the Google Search Console API and getting data back however I cannot get the specific rows.

$fromDate = date('Y-m-d', strtotime('-3 months'));
$toDate = date('Y-m-d', strtotime('-1 day'));

$client = new Google_Client();
$client->setAuthConfigFile(base_path().'/client_id.json');
$client->setAccessToken($cust->user_token);
$client->addScope(Google_Service_Webmasters::WEBMASTERS_READONLY);
$webmaster = new Google_Service_Webmasters($client);
$url = $cust->console_url;
$options = [];

$search = new Google_Service_Webmasters_SearchAnalyticsQueryRequest;
$search->setStartDate( $fromDate );
$search->setEndDate( $toDate );
$search->setDimensions( ['date'] );
$search->setAggregationType( 'auto' );

$console = $webmaster->urlcrawlerrorscounts->query($url, $options)->getCountPerTypes();
dd($console);

The Response;

array:20 [▼
  0 => Google_Service_Webmasters_UrlCrawlErrorCountsPerType {#301 ▼
    #collection_key: "entries"
    #internal_gapi_mappings: []
    +category: "notFound"
    #entriesType: "Google_Service_Webmasters_UrlCrawlErrorCount"
    #entriesDataType: "array"
    +platform: "web"
    #modelData: array:1 [▼
      "entries" => array:1 [▼
        0 => array:2 [▼
          "count" => "64"
          "timestamp" => "2016-08-04T20:15:25.816Z"
        ]
      ]
    ]
    #processed: []
  }
  1 => Google_Service_Webmasters_UrlCrawlErrorCountsPerType {#302 ▶}
  2 => Google_Service_Webmasters_UrlCrawlErrorCountsPerType {#305 ▶}
  3 => Google_Service_Webmasters_UrlCrawlErrorCountsPerType {#306 ▶}
  4 => Google_Service_Webmasters_UrlCrawlErrorCountsPerType {#307 ▶}
  5 => Google_Service_Webmasters_UrlCrawlErrorCountsPerType {#308 ▶}
  6 => Google_Service_Webmasters_UrlCrawlErrorCountsPerType {#309 ▶}
  7 => Google_Service_Webmasters_UrlCrawlErrorCountsPerType {#310 ▶}

I can get the category and platform but cannot work out how to access the count within #modelData>entries>0>count

I guest your respond is similar to Json, If that, your can try $responds_decode= json_decode("string json", true) Then it would be accessed the object like an array.

you can retrieve the values like this, with the getters and setters:

$response = $webmaster->urlcrawlerrorscounts
         ->query($url, $options)
         ->getCountPerTypes();

foreach ($response->getCountPerTypes() as $type) {

    $entries = [];

    foreach ($type->getEntries() as $entry) {
        $count = $entry->getCount();
        $timestamp = $entry->getTimestamp();
        $entries[] = [$count, $timestamp];
    }

    $platform = $type->getPlatform();
    $category = $type->getCategory();

    // Do what you want with it ...
}

Thats all the methods this class have: https://api.kdyby.org/class-Google_Service_Webmasters_UrlCrawlErrorCountsPerType.html