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 | * Options. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | private $options; |
||
41 | |||
42 | /** |
||
43 | * Initialize HTTP client options. |
||
44 | * |
||
45 | * @param array $options Client options. |
||
46 | */ |
||
47 | public function __construct($options) |
||
51 | |||
52 | /** |
||
53 | * Get API version. |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | public function getVersion() |
||
61 | |||
62 | /** |
||
63 | * Check if need to verify SSL. |
||
64 | * |
||
65 | * @return bool |
||
66 | */ |
||
67 | public function verifySsl() |
||
71 | |||
72 | /** |
||
73 | * Get timeout. |
||
74 | * |
||
75 | * @return int |
||
76 | */ |
||
77 | public function getTimeout() |
||
81 | |||
82 | /** |
||
83 | * Basic Authentication as query string. |
||
84 | * Some old servers are not able to use CURLOPT_USERPWD. |
||
85 | * |
||
86 | * @return bool |
||
87 | */ |
||
88 | public function isQueryStringAuth() |
||
92 | |||
93 | /** |
||
94 | * Check if is WP REST API. |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | public function isWPAPI() |
||
102 | |||
103 | /** |
||
104 | * Custom API Prefix for WP API. |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | public function apiPrefix() |
||
112 | } |
||
113 |