Skip to content

Commit cd09b43

Browse files
committed
Fix PHPCS
1 parent 2905d38 commit cd09b43

1 file changed

Lines changed: 23 additions & 21 deletions

File tree

themes/osi/inc/sugar-calendar.php

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
* Add date & time details to event contents.
1616
* A modified version of the function sc_add_date_time_details() of the plugin Sugar Calendar.
1717
*
18-
* @param int $post_id
18+
* @param integer $post_id Post ID.
19+
* @param boolean $show_time Show time.
20+
*
21+
* @return void
1922
*/
20-
function osi_add_date_time_details( $post_id = 0, $show_time = true ) {
23+
function osi_add_date_time_details( int $post_id = 0, bool $show_time = true ) {
2124

2225
// Support 1.x
2326
$event = sugar_calendar_get_event_by_object( $post_id );
@@ -161,7 +164,7 @@ function osi_add_date_time_details( $post_id = 0, $show_time = true ) {
161164
/**
162165
* Display ticketing information.
163166
*
164-
* @param int $post_id
167+
* @return void
165168
*/
166169
function osi_maybe_display_ticketing() {
167170
remove_action( 'sc_after_event_content', 'Sugar_Calendar\AddOn\Ticketing\Frontend\Single\display' );
@@ -174,10 +177,11 @@ function osi_maybe_display_ticketing() {
174177
/**
175178
* Add the registration button after the content in the event listing page.
176179
*
177-
* @param int $post_id
180+
* @param integer $post_id The ID of the post.
181+
*
178182
* @return void
179183
*/
180-
function osi_register_button_after_content( $post_id ) {
184+
function osi_register_button_after_content( int $post_id ) {
181185

182186
// For single posts, if ticket is priced at $0.0, display 'Free Event'.
183187
// And Button text 'Get a ticket' -> 'Register'
@@ -230,11 +234,11 @@ function osi_register_button_after_content( $post_id ) {
230234
/**
231235
* Check if the event is past.
232236
*
233-
* @param integer $post_id
237+
* @param integer $post_id Post ID.
238+
*
234239
* @return boolean
235240
*/
236-
function osi_is_past_event( $post_id ) {
237-
241+
function osi_is_past_event( int $post_id ) {
238242
$is_past_event = false;
239243

240244
$event = sugar_calendar_get_event_by_object( $post_id );
@@ -252,16 +256,16 @@ function osi_is_past_event( $post_id ) {
252256
}
253257

254258
return $is_past_event;
255-
256259
}
257260

258261
/**
259262
* Add location details to event contents.
260263
*
261-
* @param int $post_id
264+
* @param integer $post_id Post ID.
265+
*
266+
* @return void
262267
*/
263-
function osi_add_location_details( $post_id = 0 ) {
264-
268+
function osi_add_location_details( int $post_id = 0 ) {
265269
$location = sugar_calendar_get_event_by_object( $post_id, 'post' )->location;
266270

267271
// Maybe add location
@@ -283,12 +287,12 @@ function osi_add_location_details( $post_id = 0 ) {
283287
/**
284288
* Add the purchase button to the event details.
285289
*
286-
* @param string $button_html
287-
* @param object $event
290+
* @param string $button_html Button HTML.
291+
* @param object $event Event object.
288292
*
289293
* @return string
290294
*/
291-
function osi_purchase_button_html( $button_html, $event ) {
295+
function osi_purchase_button_html( string $button_html, object $event ) {
292296

293297
// Get the ticket price.
294298
$ticket_price = get_event_meta( $event->id, 'ticket_price', true );
@@ -301,21 +305,19 @@ function osi_purchase_button_html( $button_html, $event ) {
301305
$button_html = str_replace( 'Add to Cart', __( 'Get a ticket', 'osi' ), $button_html );
302306

303307
return $button_html;
304-
305308
}
306309
add_filter( 'sc_et_purchase_button_html', 'osi_purchase_button_html', 10, 2 );
307310

308311
/**
309312
* Generates default event metadata if ticket price is empty.
310313
*
311-
* @param mixed $value The value of the metadata.
312-
* @param int $object_id The ID of the object.
313-
* @param string $meta_key The key of the metadata.
314+
* @param mixed $value The value of the metadata.
315+
* @param integer $object_id The ID of the object.
316+
* @param string $meta_key The key of the metadata.
314317
*
315318
* @return mixed The modified or original value.
316319
*/
317-
function osi_default_event_metadata( $value, $object_id, $meta_key ) {
318-
320+
function osi_default_event_metadata( mixed $value, int $object_id, string $meta_key ) {
319321
if ( 'ticket_price' === $meta_key && '' === $value ) {
320322
$value = 0.0;
321323
}

0 commit comments

Comments
 (0)