PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 All 205 releases
booking / includes / page-setup-wizard / class-wpbc-setup-wizard-progressive-save-factory.php

class-wpbc-setup-wizard-progressive-save-factory.php in Booking Calendar 11.9, at includes/page-setup-wizard/class-wpbc-setup-wizard-progressive-save-factory.php

87 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Setup Wizard progressive-save collaborator factory.
4 *
5 * @package Booking Calendar
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 /**
13 * Build shared progressive-save services from one server-owned step registry.
14 */
15 final class WPBC_Setup_Wizard_Progressive_Save_Factory {
16
17 /**
18 * Register progressive handlers and checkpoint-only terminal steps.
19 *
20 * Phase 5 adds publishing as its own domain handler. The terminal review
21 * remains checkpoint-only without adding domain conditions to the coordinator.
22 *
23 * @param WPBC_Setup_Wizard_Step_Registry $step_registry Server-owned step registry.
24 *
25 * @return WPBC_Setup_Wizard_Step_Save_Registry Save-handler registry.
26 */
27 public static function create_save_registry( WPBC_Setup_Wizard_Step_Registry $step_registry ) {
28 $handlers = array(
29 new WPBC_Setup_Wizard_Metadata_Save_Handler(
30 'welcome',
31 __( 'Welcome step completed.', 'booking' )
32 ),
33 new WPBC_Setup_Wizard_Metadata_Save_Handler(
34 'business_details',
35 __( 'Business details saved for Setup Wizard guidance.', 'booking' )
36 ),
37 new WPBC_Setup_Wizard_Date_Time_Formats_Save_Handler(),
38 new WPBC_Setup_Wizard_Booking_Mode_Save_Handler(),
39 new WPBC_Setup_Wizard_Customer_Journey_Save_Handler(),
40 new WPBC_Setup_Wizard_Date_Selection_Save_Handler(),
41 new WPBC_Setup_Wizard_Services_Save_Handler(),
42 new WPBC_Setup_Wizard_Booking_Resources_Save_Handler(),
43 new WPBC_Setup_Wizard_Start_End_Times_Save_Handler(),
44 new WPBC_Setup_Wizard_Start_Duration_Times_Save_Handler(),
45 new WPBC_Setup_Wizard_Fixed_Time_Slots_Save_Handler(),
46 new WPBC_Setup_Wizard_Working_Hours_Save_Handler(),
47 new WPBC_Setup_Wizard_Days_Off_Save_Handler(),
48 new WPBC_Setup_Wizard_Booking_Form_Template_Save_Handler(),
49 new WPBC_Setup_Wizard_Appearance_Save_Handler(),
50 new WPBC_Setup_Wizard_Publish_Integration_Save_Handler(),
51 );
52 $progressive_step_ids = array( 'welcome', 'business_details', 'date_time_formats', 'booking_experience', 'customer_journey', 'date_selection', 'services', 'booking_resources', 'start_end_times', 'start_duration_times', 'fixed_time_slots', 'working_hours', 'days_off', 'booking_form_template', 'appearance', 'publish_integration' );
53 foreach ( array_keys( $step_registry->get_steps() ) as $step_id ) {
54 if ( in_array( $step_id, $progressive_step_ids, true ) ) {
55 continue;
56 }
57
58 $is_terminal = 'review_setup' === $step_id;
59 $handlers[] = new WPBC_Setup_Wizard_Checkpoint_Only_Save_Handler(
60 $step_id,
61 $is_terminal ? __( 'Finish setup', 'booking' ) : __( 'Save & continue', 'booking' ),
62 $is_terminal
63 );
64 }
65
66 return new WPBC_Setup_Wizard_Step_Save_Registry( $handlers );
67 }
68
69 /**
70 * Build the progressive-save coordinator.
71 *
72 * @param WPBC_Setup_Wizard_Draft_Store $checkpoint_store Checkpoint persistence.
73 * @param WPBC_Setup_Wizard_Draft_Validator $draft_validator Step validation service.
74 * @param WPBC_Setup_Wizard_Step_Registry $step_registry Server-owned step registry.
75 *
76 * @return WPBC_Setup_Wizard_Progressive_Save_Coordinator Coordinator.
77 */
78 public static function create_coordinator( WPBC_Setup_Wizard_Draft_Store $checkpoint_store, WPBC_Setup_Wizard_Draft_Validator $draft_validator, WPBC_Setup_Wizard_Step_Registry $step_registry ) {
79 return new WPBC_Setup_Wizard_Progressive_Save_Coordinator(
80 $checkpoint_store,
81 $draft_validator,
82 self::create_save_registry( $step_registry ),
83 new WPBC_Setup_Wizard_WordPress_Operation_Lock()
84 );
85 }
86 }
87