className = model('Analytics' . $params[1] . 'Model'); $this->methodName = 'getData' . (empty($params[2]) ? '' : $params[2]); return $this->$method( $params[0], isset($params[3]) ? $params[3] : null, ); } public function getData($podcastId, $episodeId): ResponseInterface { $analytics_model = new $this->className(); $methodName = $this->methodName; if ($episodeId) { return $this->response->setJSON( $analytics_model->$methodName($podcastId, $episodeId), ); } return $this->response->setJSON( $analytics_model->$methodName($podcastId), ); } }