set('userAgent', 'PatchTester/3.0'); // Set the default timeout to 120 seconds $options->set('timeout', 120); // Set the API URL $options->set('api.url', 'https://api.github.com'); // If an API token is set in the params, use it for authentication if ($params->get('gh_token', '')) { $options->set('gh.token', $params->get('gh_token', '')); } // Set the username and password if set in the params elseif ($params->get('gh_user', '') && $params->get('gh_password')) { $options->set('api.username', $params->get('gh_user', '')); $options->set('api.password', $params->get('gh_password', '')); } // Display a message about the lowered API limit without credentials else { \JFactory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_NO_CREDENTIALS'), 'notice'); } return new GitHub($options); } }