Advertisement
kosx

Twitter-login-php src/Config.php

Jan 11th, 2021
1,187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.77 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Abraham\TwitterOAuth;
  4.  
  5. class Config
  6. {
  7.     /** @var int How long to wait for a response from the API */
  8.     protected $timeout = 5;
  9.     /** @var int how long to wait while connecting to the API */
  10.     protected $connectionTimeout = 5;
  11.     /**
  12.      * Decode JSON Response as associative Array
  13.      *
  14.      * @see http://php.net/manual/en/function.json-decode.php
  15.      *
  16.      * @var bool
  17.      */
  18.     protected $decodeJsonAsArray = false;
  19.     /** @var string User-Agent header */
  20.     protected $userAgent = 'TwitterOAuth (+https://twitteroauth.com)';
  21.     /** @var array Store proxy connection details */
  22.     protected $proxy = [];
  23.  
  24.     /** @var bool Whether to encode the curl requests with gzip or not */
  25.     protected $gzipEncoding = true;
  26.  
  27.     /**
  28.      * Set the connection and response timeouts.
  29.      *
  30.      * @param int $connectionTimeout
  31.      * @param int $timeout
  32.      */
  33.     public function setTimeouts($connectionTimeout, $timeout)
  34.     {
  35.         $this->connectionTimeout = (int)$connectionTimeout;
  36.         $this->timeout = (int)$timeout;
  37.     }
  38.  
  39.     /**
  40.      * @param bool $value
  41.      */
  42.     public function setDecodeJsonAsArray($value)
  43.     {
  44.         $this->decodeJsonAsArray = (bool)$value;
  45.     }
  46.  
  47.     /**
  48.      * @param string $userAgent
  49.      */
  50.     public function setUserAgent($userAgent)
  51.     {
  52.         $this->userAgent = (string)$userAgent;
  53.     }
  54.  
  55.     /**
  56.      * @param array $proxy
  57.      */
  58.     public function setProxy(array $proxy)
  59.     {
  60.         $this->proxy = $proxy;
  61.     }
  62.  
  63.     /**
  64.      * Whether to encode the curl requests with gzip or not.
  65.      *
  66.      * @param boolean $gzipEncoding
  67.      */
  68.     public function setGzipEncoding($gzipEncoding)
  69.     {
  70.         $this->gzipEncoding = (bool)$gzipEncoding;
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement