x-fran / g-trends

Google Trends API for PHP
https://tarlabs.es
MIT License
112 stars 47 forks source link

Fix: empty geo when fetching geo map broken #45

Closed warna720 closed 2 years ago

warna720 commented 2 years ago

To reproduce bug:

use Google\GTrends;
$options = [ 'hl'  => 'sv', 'tz'  => -60, 'geo' => ''];
$gt = new GTrends($options);
$r = $gt->explore(['foo', 'bar'], time: 'today 5-y');

Apparently, Google doesn't adhere to standards since geo:[] isn't appreciated and only accepts geo:{}. This PR replaces, after json encoding, geo:[] with geo:{}.

Open for feedback.

warna720 commented 2 years ago

Would be nice to get approved and a new release when/if everything ok!