/** * Convenience method to append any optional arguments to the specified * <var>$httpGet</var> object. * * @param HttpGet $httpGet HttpGet object to append to * @param OptArgs $optArgs optional arguments used for appending * * @return void */ private function _appendOptArgs(HttpGet $httpGet, OptArgs $optArgs) { $keys = array('AgeGroup', 'AreaCode', 'City', 'Country', 'Gender', 'Keywords', 'Latitude', 'Longitude', 'MaxHeight', 'MaxWidth', 'MinHeight', 'MinWidth', 'Type', 'ZipCode'); $keywords = implode(',', $optArgs->getKeywords()); $vals = array($optArgs->getAgeGroup(), $optArgs->getAreaCode(), $optArgs->getCity(), $optArgs->getCountry(), $optArgs->getGender(), $keywords, $optArgs->getLatitude(), $optArgs->getLongitude(), $optArgs->getMaxHeight(), $optArgs->getMaxWidth(), $optArgs->getMinHeight(), $optArgs->getMinWidth(), $optArgs->getAdType(), $optArgs->getZipCode()); for ($i = 0; $i < count($keys); ++$i) { $key = $keys[$i]; $val = $vals[$i]; if ($val != null) { $httpGet->setParam($key, $val); } } }