Thujohn\Twitter\Twitter::__construct PHP Метод

__construct() публичный Метод

public __construct ( Illuminate\Config\Repository $config, Illuminate\Session\Store $session )
$config Illuminate\Config\Repository
$session Illuminate\Session\Store
    public function __construct(Config $config, SessionStore $session)
    {
        if ($config->has('ttwitter::config')) {
            $this->tconfig = $config->get('ttwitter::config');
        } else {
            if ($config->get('ttwitter')) {
                $this->tconfig = $config->get('ttwitter');
            } else {
                throw new Exception('No config found');
            }
        }
        $this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false;
        $this->parent_config = [];
        $this->parent_config['consumer_key'] = $this->tconfig['CONSUMER_KEY'];
        $this->parent_config['consumer_secret'] = $this->tconfig['CONSUMER_SECRET'];
        $this->parent_config['token'] = $this->tconfig['ACCESS_TOKEN'];
        $this->parent_config['secret'] = $this->tconfig['ACCESS_TOKEN_SECRET'];
        if ($session->has('access_token')) {
            $access_token = $session->get('access_token');
            if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) {
                $this->parent_config['token'] = $access_token['oauth_token'];
                $this->parent_config['secret'] = $access_token['oauth_token_secret'];
            }
        }
        $this->parent_config['use_ssl'] = $this->tconfig['USE_SSL'];
        $this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION;
        $config = array_merge($this->parent_config, $this->tconfig);
        parent::__construct($this->parent_config);
    }