register_endpoint_handlers(); // Loop through registered handlers and register their routes foreach ( self::$endpoint_handlers as $handler ) { if ( method_exists( $handler, 'register_routes' ) ) { $handler->register_routes(); } } } /** * Registers all endpoint handlers. * * @since 3.5.0 */ private function register_endpoint_handlers() { self::$endpoint_handlers = []; // Instantiate all handler classes from the constant foreach ( self::ENDPOINT_HANDLERS as $handler_class ) { self::$endpoint_handlers[] = new $handler_class(); } /** * Filter the REST API endpoint handlers. * * @since 3.5.0 * * @param array $endpoint_handlers Array of endpoint handler instances */ self::$endpoint_handlers = apply_filters( 'wc_facebook_rest_endpoint_handlers', self::$endpoint_handlers ); } /** * Gets the API namespace. * * @since 3.5.0 * * @return string */ public static function get_namespace() { return self::API_NAMESPACE; } /** * Gets all JS-enabled request classes. * * @since 3.5.0 * * @return array */ public static function get_js_enabled_requests() { return self::JS_ENABLED_REQUESTS; } }