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( int $podcastId, ?int $episodeId = null ): ResponseInterface { $analyticsModel = new $this->className(); $methodName = $this->methodName; if ($episodeId === null) { return $this->response->setJSON( $analyticsModel->$methodName($podcastId), ); } return $this->response->setJSON( $analyticsModel->$methodName($podcastId, $episodeId), ); } }