S3_Uploads::s3 PHP Method

s3() public method

public s3 ( ) : Aws\S3\S3Client
return Aws\S3\S3Client
    public function s3()
    {
        if (!empty($this->s3)) {
            return $this->s3;
        }
        $params = array('version' => 'latest');
        if ($this->key && $this->secret) {
            $params['credentials']['key'] = $this->key;
            $params['credentials']['secret'] = $this->secret;
        }
        if ($this->region) {
            $params['signature'] = 'v4';
            $params['region'] = $this->region;
        }
        if (defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT')) {
            $proxy_auth = '';
            $proxy_address = WP_PROXY_HOST . ':' . WP_PROXY_PORT;
            if (defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')) {
                $proxy_auth = WP_PROXY_USERNAME . ':' . WP_PROXY_PASSWORD . '@';
            }
            $params['request.options']['proxy'] = $proxy_auth . $proxy_address;
        }
        $params = apply_filters('s3_uploads_s3_client_params', $params);
        $this->s3 = Aws\S3\S3Client::factory($params);
        return $this->s3;
    }