2121 */
2222class Registrar extends Service {
2323
24- /**
24+ /**
2525 * Namespace for the endpoints this registrar registers.
2626 *
2727 * @since 2019-10-16
2828 *
2929 * @var string
3030 */
31- public static $ namespace = 'wc/cc-woo ' ;
31+ public static $ namespace = 'wc/cc-woo ' ;
3232
3333 /**
3434 * Register hooks.
@@ -37,9 +37,9 @@ class Registrar extends Service {
3737 * @since 2019-11-13
3838 */
3939 public function register_hooks () {
40- add_action ( 'rest_api_init ' , [ $ this , 'init_rest_endpoints ' ] );
41- add_filter ( 'woocommerce_rest_is_request_to_rest_api ' , [ $ this , 'register_endpoints_with_woo_auth_handler ' ] );
42- }
40+ add_action ( 'rest_api_init ' , [ $ this , 'init_rest_endpoints ' ] );
41+ add_filter ( 'woocommerce_rest_is_request_to_rest_api ' , [ $ this , 'register_endpoints_with_woo_auth_handler ' ] );
42+ }
4343
4444 /**
4545 * Initialize REST endpoints.
@@ -49,27 +49,27 @@ public function register_hooks() {
4949 */
5050 public function init_rest_endpoints () {
5151 ( new AbandonedCartsController () )->register_routes ();
52- }
52+ }
5353
54- /**
54+ /**
5555 * Register REST endpoints with wc/cc-woo namespace with WooCommerce's REST auth handler.
5656 *
5757 * @author George Gecewicz <[email protected] > 5858 * @since 2019-11-13
59- *
60- * @return bool
59+ *
60+ * @return bool
6161 */
62- public function register_endpoints_with_woo_auth_handler () {
63- $ request_uri = esc_url_raw ( wp_unslash ( $ _SERVER ['REQUEST_URI ' ] ) );
62+ public function register_endpoints_with_woo_auth_handler () {
63+ $ request_uri = esc_url_raw ( wp_unslash ( $ _SERVER ['REQUEST_URI ' ] ) );
6464
65- if ( empty ( $ request_uri ) ) {
66- return false ;
67- }
65+ if ( empty ( $ request_uri ) ) {
66+ return false ;
67+ }
6868
6969 $ rest_prefix = trailingslashit ( rest_get_url_prefix () );
7070
71- return false !== strpos ( $ request_uri , $ rest_prefix . self ::$ namespace );
72- }
71+ return false !== strpos ( $ request_uri , $ rest_prefix . self ::$ namespace );
72+ }
7373
7474}
7575
0 commit comments