. */ require_once('HistogramTransform.php'); class CountField extends HistogramTransform { function __construct($valueField, $groupByField = null) { parent::__construct($valueField, $groupByField); } public function addEntry(&$entry) { if (array_key_exists($this->valueField, $entry)) { $value = $entry[$this->valueField]; $groupByName = empty($this->groupByField) ? $this->valueField : $entry[$this->groupByField]; if ($value !== null && $value !== '') { if (array_key_exists($groupByName, $this->values)) { $this->values[$groupByName]++; } else { $this->values[$groupByName] = 1; } } } } }