@@ -31,11 +31,11 @@ public function __construct( array $args ) {
31
31
$ this ->daily_limit = (int ) $ args ['daily_limit ' ];
32
32
33
33
if ( empty ( $ this ->service_ids ) || $ this ->daily_limit < 1 ) {
34
- return ;
35
- }
34
+ return ;
35
+ }
36
36
37
37
// Guard creation and REST availability so the cap is enforced everywhere.
38
- add_action ( 'gpb_before_booking_created ' , array ( $ this , 'guard_booking_creation ' ), 10 , 2 );
38
+ add_action ( 'gpb_before_booking_created ' , array ( $ this , 'guard_booking_creation ' ), 10 , 2 );
39
39
add_filter ( 'rest_post_dispatch ' , array ( $ this , 'filter_rest_availability ' ), 10 , 3 );
40
40
}
41
41
@@ -109,7 +109,7 @@ public function filter_rest_availability( $response, $server, $request ) {
109
109
return $ response ;
110
110
}
111
111
112
- private function exceeds_limit ( array $ dates , int $ incoming_quantity = 0 , ? int $ exclude_booking_id = null ): bool {
112
+ private function exceeds_limit ( array $ dates , int $ incoming_quantity = 0 , $ exclude_booking_id = null ): bool {
113
113
$ dates = array_filter ( array_unique ( $ dates ) );
114
114
$ totals = $ dates ? $ this ->get_daily_totals ( $ dates , $ exclude_booking_id ) : array ();
115
115
@@ -123,7 +123,7 @@ private function exceeds_limit( array $dates, int $incoming_quantity = 0, ?int $
123
123
return false ;
124
124
}
125
125
126
- private function get_daily_totals ( array $ dates , ? int $ exclude_booking_id = null ): array {
126
+ private function get_daily_totals ( array $ dates , $ exclude_booking_id = null ): array {
127
127
$ dates = array_values ( array_filter ( array_unique ( array_map ( 'trim ' , $ dates ) ) ) );
128
128
if ( ! $ dates ) {
129
129
return array ();
@@ -135,7 +135,7 @@ private function get_daily_totals( array $dates, ?int $exclude_booking_id = null
135
135
return $ this ->get_totals_for_range ( $ start_datetime , $ end_datetime , $ exclude_booking_id );
136
136
}
137
137
138
- private function get_totals_for_range ( string $ start_datetime , string $ end_datetime , ? int $ exclude_booking_id = null ): array {
138
+ private function get_totals_for_range ( string $ start_datetime , string $ end_datetime , $ exclude_booking_id = null ): array {
139
139
if ( '' === $ start_datetime || '' === $ end_datetime ) {
140
140
return array ();
141
141
}
0 commit comments