<commit_before><?php

/**
 * This class provides social signon capability and an abstraction to social media APIs
 *
 * @package     Nails
 * @subpackage  module-auth
 * @category    Library
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\Auth\Library;

use Nails\Factory;

class SocialSignOn
{
    use \Nails\Common\Traits\ErrorHandling;
    use \Nails\Common\Traits\Caching;

    // --------------------------------------------------------------------------

    protected $oDb;
    protected $oUserModel;
    protected $aProviders;
    protected $oHybridAuth;

    // --------------------------------------------------------------------------

    /**
     * Cosntructs the class
     */
    public function __construct()
    {
        $oCi              = get_instance();
        $this->oDb        = Factory::service('Database');
        $this->oUserModel = Factory::service('User', 'nailsapp/module-auth');

        $this->aProviders = array('all' => array(), 'enabled' => array(), 'disabled' => array());

        //  Set up Providers
        $oCi->config->load('auth/auth');
        $aConfig = $oCi->config->item('auth_social_signon_providers');

        if (is_array($aConfig) && !empty($aConfig)) {

            foreach ($aConfig as $aProvider) {

                $this->aProviders['all'][strtolower($aProvider['slug'])] = $aProvider;

                if (app_setting('auth_social_signon_' . $aProvider['slug'] . '_enabled', 'auth')) {

                    $this->aProviders['enabled'][strtolower($aProvider['slug'])] = $aProvider;

                } else {

                    $this->aProviders['disabled'][strtolower($aProvider['slug'])] = $aProvider;
                }
            }

        } else {

            showFatalError(
                'No providers are configured',<commit_msg>Urgh, another oops<commit_after><?php

/**
 * This class provides social signon capability and an abstraction to social media APIs
 *
 * @package     Nails
 * @subpackage  module-auth
 * @category    Library
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\Auth\Library;

use Nails\Factory;

class SocialSignOn
{
    use \Nails\Common\Traits\ErrorHandling;
    use \Nails\Common\Traits\Caching;

    // --------------------------------------------------------------------------

    protected $oDb;
    protected $oUserModel;
    protected $aProviders;
    protected $oHybridAuth;

    // --------------------------------------------------------------------------

    /**
     * Cosntructs the class
     */
    public function __construct()
    {
        $oCi              = get_instance();
        $this->oDb        = Factory::service('Database');
        $this->oUserModel = Factory::model('User', 'nailsapp/module-auth');

        $this->aProviders = array('all' => array(), 'enabled' => array(), 'disabled' => array());

        //  Set up Providers
        $oCi->config->load('auth/auth');
        $aConfig = $oCi->config->item('auth_social_signon_providers');

        if (is_array($aConfig) && !empty($aConfig)) {

            foreach ($aConfig as $aProvider) {

                $this->aProviders['all'][strtolower($aProvider['slug'])] = $aProvider;

                if (app_setting('auth_social_signon_' . $aProvider['slug'] . '_enabled', 'auth')) {

                    $this->aProviders['enabled'][strtolower($aProvider['slug'])] = $aProvider;

                } else {

                    $this->aProviders['disabled'][strtolower($aProvider['slug'])] = $aProvider;
                }
            }

        } else {

            showFatalError(
                'No providers are configured',
{'fraction_non_alphanumeric': 0.21796638192339488, 'fraction_numerical': 0.0, 'mean_word_length': 1.7313769751693002, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '491991', 'n_tokens_mistral': 1033, 'n_tokens_neox': 988, 'n_words': 189}