1 | <?php |
||
10 | class Config |
||
11 | { |
||
12 | /** @var int How long to wait for a response from the API */ |
||
13 | protected $timeout = 5; |
||
14 | /** @var int how long to wait while connecting to the API */ |
||
15 | protected $connectionTimeout = 5; |
||
16 | /** @var int How many times we retry request when API is down */ |
||
17 | protected $maxRetries = 0; |
||
18 | /** @var int Delay in seconds before we retry the request */ |
||
19 | protected $retriesDelay = 1; |
||
20 | |||
21 | |||
22 | |||
23 | /** |
||
24 | * Decode JSON Response as associative Array |
||
25 | * |
||
26 | * @see http://php.net/manual/en/function.json-decode.php |
||
27 | * |
||
28 | * @var bool |
||
29 | */ |
||
30 | protected $decodeJsonAsArray = false; |
||
31 | /** @var string User-Agent header */ |
||
32 | protected $userAgent = 'TwitterOAuth (+https://twitteroauth.com)'; |
||
33 | /** @var array Store proxy connection details */ |
||
34 | protected $proxy = []; |
||
35 | |||
36 | /** @var bool Whether to encode the curl requests with gzip or not */ |
||
37 | protected $gzipEncoding = true; |
||
38 | |||
39 | /** @var integer Size for Chunked Uploads */ |
||
40 | protected $chunkSize = 250000; // 0.25 MegaByte |
||
41 | |||
42 | /** |
||
43 | * Set the connection and response timeouts. |
||
44 | * |
||
45 | * @param int $connectionTimeout |
||
46 | * @param int $timeout |
||
47 | */ |
||
48 | public function setTimeouts($connectionTimeout, $timeout) |
||
53 | |||
54 | /** |
||
55 | * Set the number of times to retry on error and how long between each. |
||
56 | * |
||
57 | * @param int $maxRetries |
||
58 | * @param int $retriesDelay |
||
59 | */ |
||
60 | public function setRetries($maxRetries, $retriesDelay) |
||
65 | |||
66 | /** |
||
67 | * @param bool $value |
||
68 | */ |
||
69 | public function setDecodeJsonAsArray($value) |
||
73 | |||
74 | /** |
||
75 | * @param string $userAgent |
||
76 | */ |
||
77 | public function setUserAgent($userAgent) |
||
81 | |||
82 | /** |
||
83 | * @param array $proxy |
||
84 | */ |
||
85 | public function setProxy(array $proxy) |
||
89 | |||
90 | /** |
||
91 | * Whether to encode the curl requests with gzip or not. |
||
92 | * |
||
93 | * @param boolean $gzipEncoding |
||
94 | */ |
||
95 | public function setGzipEncoding($gzipEncoding) |
||
99 | |||
100 | /** |
||
101 | * Set the size of each part of file for chunked media upload. |
||
102 | * |
||
103 | * @param int $value |
||
104 | */ |
||
105 | public function setChunkSize($value) |
||
109 | } |
||
110 |