1 | <?php |
||
16 | class Options |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * Default WooCommerce REST API version. |
||
21 | */ |
||
22 | const VERSION = 'v3'; |
||
23 | |||
24 | /** |
||
25 | * Default request timeout. |
||
26 | */ |
||
27 | const TIMEOUT = 15; |
||
28 | |||
29 | /** |
||
30 | * Default WP API prefix. |
||
31 | * Including leading and trailing slashes. |
||
32 | */ |
||
33 | const WP_API_PREFIX = '/wp-json/'; |
||
34 | |||
35 | /** |
||
36 | * Default User Agent. |
||
37 | * No version number. |
||
38 | */ |
||
39 | const USER_AGENT = 'WooCommerce API Client-PHP'; |
||
40 | |||
41 | /** |
||
42 | * Options. |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | private $options; |
||
47 | |||
48 | /** |
||
49 | * Initialize HTTP client options. |
||
50 | * |
||
51 | * @param array $options Client options. |
||
52 | */ |
||
53 | public function __construct($options) |
||
57 | |||
58 | /** |
||
59 | * Get API version. |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getVersion() |
||
67 | |||
68 | /** |
||
69 | * Check if need to verify SSL. |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function verifySsl() |
||
77 | |||
78 | /** |
||
79 | * Get timeout. |
||
80 | * |
||
81 | * @return int |
||
82 | */ |
||
83 | public function getTimeout() |
||
87 | |||
88 | /** |
||
89 | * Basic Authentication as query string. |
||
90 | * Some old servers are not able to use CURLOPT_USERPWD. |
||
91 | * |
||
92 | * @return bool |
||
93 | */ |
||
94 | public function isQueryStringAuth() |
||
98 | |||
99 | /** |
||
100 | * Check if is WP REST API. |
||
101 | * |
||
102 | * @return bool |
||
103 | */ |
||
104 | public function isWPAPI() |
||
108 | |||
109 | /** |
||
110 | * Custom API Prefix for WP API. |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | public function apiPrefix() |
||
118 | |||
119 | /** |
||
120 | * oAuth timestamp. |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | public function oauthTimestamp() |
||
128 | |||
129 | /** |
||
130 | * Custom user agent. |
||
131 | * |
||
132 | * @return string |
||
133 | */ |
||
134 | public function userAgent() |
||
138 | |||
139 | /** |
||
140 | * Get follow redirects |
||
141 | * |
||
142 | * @return bool |
||
143 | */ |
||
144 | public function getFollowRedirects() |
||
149 | } |
||
150 |