examples/src/ExampleGroupByQueries/ReferralsByCompanyGroupByQueryGenerator.php
public function generateQuery(IDruidQueryParameters $params)
    {
        // @var ReferralsByCompanyGroupByQueryParameters $params
        $query = $this->queryTemplate;

        $query = str_replace('{DATASOURCE}',    $params->dataSource,    $query);
        $query = str_replace('{STARTINTERVAL}', $params->startInterval, $query);
        $query = str_replace('{ENDINTERVAL}',   $params->endInterval,   $query);

        return $query;
    }
public function generateQuery(IDruidQueryParameters $params)
    {
        // @var ReferralsByCompanyGroupByQueryParameters $params
        $query = $this->queryTemplate;

        $query = str_replace('{DATASOURCE}',    $params->dataSource,    $query);
        $query = str_replace('{STARTINTERVAL}', $params->startInterval, $query);
        $query = str_replace('{ENDINTERVAL}',   $params->endInterval,   $query);

        return $query;
    }
Take parameters and return a valid Druid Query.

@param ReferralsByCompanyGroupByQueryParameters $params
@return string Query payload in JSON