protected function _fetchData() { // first try to connect, if we don't already have a token $this->_getAuthToken(); // get the http client $hClient = & Sh404sefHelperAnalytics::getHttpClient(); // fetch account list from supplier $this->_fetchAccountsList(); // and find about which one to use (use first one is none selected from a previous request if (empty( $this->_options['accountId'])) { $this->_options['accountId'] = Sh404sefHelperAnalytics::getDefaultAccountId( $this->_accounts); } // check in case we don' have valid account ID if (empty( $this->_options['accountId'])) { throw new Sh404sefExceptionDefault( 'Empty account ID to query analytics API. Contact admin.'); } // create a report object $className = 'Sh404sefAdapterAnalytics' . strtolower( $this->_config->analyticsType). 'report' . strtolower( $this->_options['report']); $report = new $className(); // ask it to perform API requests as needed, $dataResponse = $report->fetchData( $this->_config, $this->_options, $this->_Auth, $this->_endPoint); // return data response for further processing return $dataResponse; }