/** * @param $config * @param $reportId * @return mixed */ public function build($config, $reportId) { $callable = $this->resolveSourceResultMethod($config['source'], $reportId); if (is_callable(array($this, $callable))) { $result = $this->{$callable}($config['source']); } else { throw new \RuntimeException(); } if (empty($result)) { return []; } $chart = $this->chartTypeProvider->getChartTypeObject($config['chart']['type']); return $chart->extractData($result, $config); }
/** * @param $config * @param $reportId * @return mixed */ public function build($config, $reportId) { $method = $this->resolveSourceResultMethod($config['source'], $reportId); if (method_exists($this, $method)) { $result = call_user_func_array([$this, $method], [$config['source']]); } else { throw new \RuntimeException(); } if (empty($result)) { return []; } $chart = $this->chartTypeProvider->getChartTypeObject($config['chart']['type']); return $chart->extractData($result, $config); }