availabilityEndpoint = new AvailabilityEndpoint( $availability, $offerings ); $this->bookingEndpoint = new BookingEndpoint( $availability, $bookings, $offerings, $gate, $paymentService ); $this->offeringEndpoint = new OfferingEndpoint( $offerings ); $this->questionEndpoint = new QuestionEndpoint( $questions, $offerings ); $this->policyEndpoint = new PolicyEndpoint( $policies, $policyVersions, $policyService ); $this->enrollmentEndpoint = new EnrollmentEndpoint( $enrollments, $offerings, $gate, $paymentService ); $this->paymentEndpoint = new PaymentEndpoint( $paymentService ); } public function register(): void { add_action( 'rest_api_init', [ $this, 'registerRoutes' ] ); } public function registerRoutes(): void { $this->availabilityEndpoint->registerRoutes( self::NAMESPACE ); $this->bookingEndpoint->registerRoutes( self::NAMESPACE ); $this->offeringEndpoint->registerRoutes( self::NAMESPACE ); $this->questionEndpoint->registerRoutes( self::NAMESPACE ); $this->policyEndpoint->registerRoutes( self::NAMESPACE ); $this->enrollmentEndpoint->registerRoutes( self::NAMESPACE ); $this->paymentEndpoint->registerRoutes( self::NAMESPACE ); } }