for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace GSoares\GoogleTrends\Result;
use GSoares\GoogleTrends\Error\GoogleTrendsException;
/**
* @author Gabriel Felipe Soares <[email protected]>
*/
class ExploreResultCollection
{
* @var ExploreResult[]
public $results;
public function __construct(ExploreResult ...$terms)
$this->results = $terms;
}
* @return RelatedResult[]
public function getResults(): array
return $this->results;
* @return ExploreResult
*
* @throws GoogleTrendsException
public function getRelatedQueriesResult(): ExploreResult
foreach ($this->results as $result) {
if ($result->isRelatedQueriesSearch()) {
return $result;
throw new GoogleTrendsException('No explore result available for related queries!');
public function getRelatedTopicsResult(): ExploreResult
if ($result->isRelatedTopicsSearch()) {
throw new GoogleTrendsException('No explore result available for related topics!');
public function getInterestOverTimeResult(): ExploreResult
if ($result->isInterestOverTimeSearch()) {
throw new GoogleTrendsException('No explore result available for interest over time!');