3232 * This class provides a standardized framework for constructing an API wrapper
3333 * to external services. It is designed to be extremely flexible.
3434 *
35- * @version 2.1-1
35+ * @version 2.2.0
3636 */
3737abstract class SV_WC_API_Base {
3838
@@ -80,7 +80,7 @@ abstract class SV_WC_API_Base {
8080 /**
8181 * Perform the request and return the parsed response
8282 *
83- * @since 2.1-1
83+ * @since 2.2.0
8484 * @param object $request class instance which implements \SV_WC_API_Request
8585 * @throws Exception
8686 * @throws \SV_WC_API_Exception
@@ -121,7 +121,7 @@ protected function perform_request( $request ) {
121121 * and provide their own transport mechanism if needed, e.g. a custom
122122 * cURL implementation
123123 *
124- * @since 2.1-1
124+ * @since 2.2.0
125125 * @param string $request_uri
126126 * @param string $request_args
127127 * @return array|WP_Error
@@ -134,7 +134,7 @@ protected function do_remote_request( $request_uri, $request_args ) {
134134 /**
135135 * Handle and parse the response
136136 *
137- * @since 2.1-1
137+ * @since 2.2.0
138138 * @param array|WP_Error $response response data
139139 * @throws \SV_WC_API_Exception network issues, timeouts, API errors, etc
140140 * @return object request class instance that implements SV_WC_API_Request
@@ -185,7 +185,7 @@ protected function handle_response( $response ) {
185185 * an exception, as it will be included in the broadcast_request() method
186186 * which is typically used to log requests.
187187 *
188- * @since 2.1-1
188+ * @since 2.2.0
189189 */
190190 protected function do_pre_parse_response_validation () {
191191 // stub method
@@ -203,7 +203,7 @@ protected function do_pre_parse_response_validation() {
203203 *
204204 * Note: Response body sanitization is handled automatically
205205 *
206- * @since 2.1-1
206+ * @since 2.2.0
207207 */
208208 protected function do_post_parse_response_validation () {
209209 // stub method
@@ -213,7 +213,7 @@ protected function do_post_parse_response_validation() {
213213 /**
214214 * Return the parsed response object for the request
215215 *
216- * @since 2.1-1
216+ * @since 2.2.0
217217 * @param string $raw_response_body
218218 * @return object response class instance which implements SV_WC_API_Request
219219 */
@@ -229,7 +229,7 @@ protected function get_parsed_response( $raw_response_body ) {
229229 * Alert other actors that a request has been performed. This is primarily used
230230 * for request logging.
231231 *
232- * @since 2.1-1
232+ * @since 2.2.0
233233 */
234234 private function broadcast_request () {
235235
@@ -259,7 +259,7 @@ private function broadcast_request() {
259259 /**
260260 * Get the request URI
261261 *
262- * @since 2.1-1
262+ * @since 2.2.0
263263 * @return string
264264 */
265265 protected function get_request_uri () {
@@ -270,7 +270,7 @@ protected function get_request_uri() {
270270 /**
271271 * Get the request arguments in the format required by wp_remote_request()
272272 *
273- * @since 2.1-1
273+ * @since 2.2.0
274274 * @return mixed|void
275275 */
276276 protected function get_request_args () {
@@ -297,7 +297,7 @@ protected function get_request_args() {
297297 *
298298 * @param array $args request arguments
299299 * @param \SV_WC_API_Base class instance
300- * @since 2.1-1
300+ * @since 2.2.0
301301 */
302302 return apply_filters ( 'wc_ ' . $ this ->get_api_id () . '_http_request_args ' , $ args , $ this );
303303 }
@@ -306,7 +306,7 @@ protected function get_request_args() {
306306 /**
307307 * Get the request method, POST by default
308308 *
309- * @since 2.1-1
309+ * @since 2.2.0
310310 * @return string
311311 */
312312 protected function get_request_method () {
@@ -317,7 +317,7 @@ protected function get_request_method() {
317317 /**
318318 * Get the request HTTP version, 1.1 by default
319319 *
320- * @since 2.1-1
320+ * @since 2.2.0
321321 * @return string
322322 */
323323 protected function get_request_http_version () {
@@ -329,7 +329,7 @@ protected function get_request_http_version() {
329329 /**
330330 * Get the request headers
331331 *
332- * @since 2.1-1
332+ * @since 2.2.0
333333 * @return array
334334 */
335335 protected function get_request_headers () {
@@ -346,7 +346,7 @@ protected function get_request_headers() {
346346 * Child classes that implement any custom authorization headers should
347347 * override this method to perform sanitization.
348348 *
349- * @since 2.1-1
349+ * @since 2.2.0
350350 * @return array
351351 */
352352 protected function get_sanitized_request_headers () {
@@ -366,7 +366,7 @@ protected function get_sanitized_request_headers() {
366366 *
367367 * Dasherized-Plugin-Name/Plugin-Version (WooCommerce/WC-Version; WordPress/WP-Version)
368368 *
369- * @since 2.1-1
369+ * @since 2.2.0
370370 * @return string
371371 */
372372 protected function get_request_user_agent () {
@@ -378,7 +378,7 @@ protected function get_request_user_agent() {
378378 /**
379379 * Get the request duration in seconds, rounded to the 5th decimal place
380380 *
381- * @since 2.1-1
381+ * @since 2.2.0
382382 * @return string
383383 */
384384 protected function get_request_duration () {
@@ -392,7 +392,7 @@ protected function get_request_duration() {
392392 /**
393393 * Get the response handler class name
394394 *
395- * @since 2.1-1
395+ * @since 2.2.0
396396 * @return string
397397 */
398398 protected function get_response_handler () {
@@ -403,7 +403,7 @@ protected function get_response_handler() {
403403 /**
404404 * Get the response code
405405 *
406- * @since 2.1-1
406+ * @since 2.2.0
407407 * @return string
408408 */
409409 protected function get_response_code () {
@@ -414,7 +414,7 @@ protected function get_response_code() {
414414 /**
415415 * Get the response message
416416 *
417- * @since 2.1-1
417+ * @since 2.2.0
418418 * @return string
419419 */
420420 protected function get_response_message () {
@@ -425,7 +425,7 @@ protected function get_response_message() {
425425 /**
426426 * Get the response headers
427427 *
428- * @since 2.1-1
428+ * @since 2.2.0
429429 * @return array
430430 */
431431 protected function get_response_headers () {
@@ -436,7 +436,7 @@ protected function get_response_headers() {
436436 /**
437437 * Get the raw response body, prior to any parsing or sanitization
438438 *
439- * @since 2.1-1
439+ * @since 2.2.0
440440 * @return string
441441 */
442442 protected function get_raw_response_body () {
@@ -448,7 +448,7 @@ protected function get_raw_response_body() {
448448 * Get the sanitized response body, provided by the response class
449449 * to_string_safe() method
450450 *
451- * @since 2.1-1
451+ * @since 2.2.0
452452 * @return string|null
453453 */
454454 protected function get_sanitized_response_body () {
@@ -462,7 +462,7 @@ protected function get_sanitized_response_body() {
462462 /**
463463 * Returns the most recent request object
464464 *
465- * @since 2.1-1
465+ * @since 2.2.0
466466 * @see \SV_WC_API_Request
467467 * @return object the most recent request object
468468 */
@@ -474,7 +474,7 @@ public function get_request() {
474474 /**
475475 * Returns the most recent response object
476476 *
477- * @since 2.1-1
477+ * @since 2.2.0
478478 * @see \SV_WC_API_Response
479479 * @return object the most recent response object
480480 */
@@ -487,7 +487,7 @@ public function get_response() {
487487 * Get the ID for the API, used primarily to namespace the action name
488488 * for broadcasting requests
489489 *
490- * @since 2.1-1
490+ * @since 2.2.0
491491 * @return string
492492 */
493493 protected function get_api_id () {
@@ -503,7 +503,7 @@ protected function get_api_id() {
503503 * \SV_WC_API_Request which should be used in the child class API methods
504504 * to build the request. This is then passed to self::perform_request()
505505 *
506- * @since 2.1-1
506+ * @since 2.2.0
507507 * @param string $type optional request type
508508 * @return \SV_WC_API_Request
509509 */
@@ -518,7 +518,7 @@ abstract protected function get_new_request( $type = null );
518518 * This is used for defining the plugin ID used in filter names, as well
519519 * as the plugin name used for the default user agent.
520520 *
521- * @since 2.1-1
521+ * @since 2.2.0
522522 * @return \SV_WC_Plugin
523523 */
524524 abstract protected function get_plugin ();
@@ -530,7 +530,7 @@ abstract protected function get_plugin();
530530 /**
531531 * Set a header request
532532 *
533- * @since 2.1-1
533+ * @since 2.2.0
534534 * @param string $name header name
535535 * @param string $value header value
536536 * @return string
@@ -544,7 +544,7 @@ protected function set_request_header( $name, $value ) {
544544 /**
545545 * Set HTTP basic auth for the request
546546 *
547- * Since 2.1-1
547+ * Since 2.2.0
548548 * @param string $username
549549 * @param string $password
550550 */
@@ -557,7 +557,7 @@ protected function set_http_basic_auth( $username, $password ) {
557557 /**
558558 * Set the Content-Type request header
559559 *
560- * @since 2.1-1
560+ * @since 2.2.0
561561 * @param string $content_type
562562 */
563563 protected function set_request_content_type_header ( $ content_type ) {
@@ -568,7 +568,7 @@ protected function set_request_content_type_header( $content_type ) {
568568 /**
569569 * Set the Accept request header
570570 *
571- * @since 2.1-1
571+ * @since 2.2.0
572572 * @param $type
573573 */
574574 protected function set_request_accept_header ( $ type ) {
@@ -582,7 +582,7 @@ protected function set_request_accept_header( $type ) {
582582 *
583583 * Note the class should implement SV_WC_API
584584 *
585- * @since 2.1-1
585+ * @since 2.2.0
586586 * @param string $handler handle class name
587587 * @return array
588588 */
0 commit comments