Skip to content

Commit fc2de02

Browse files
committed
Refactored: Used null coalesce operator instead of isset
1 parent 13891e9 commit fc2de02

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

templates/learning-area/subpages/qna/qna-card.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
$current_user_id = get_current_user_id();
2121
$is_user_asker = $current_user_id === (int) $question->user_id;
2222

23-
$limit = 60;
23+
$limit = 60; // Content text limit.
2424
$content = wp_strip_all_tags( $question->comment_content );
2525
$content = strlen( $content ) > $limit ? substr( $content, 0, $limit ) . '...' : $content;
2626

templates/learning-area/subpages/qna/qna-form.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
use Tutor\Components\InputField;
1919
use TUTOR\Icon;
2020

21-
$form_id = isset( $form_id ) ? $form_id : '';
22-
$label = isset( $label ) ? $label : '';
23-
$submit_label = isset( $submit_label ) ? $submit_label : __( 'Update', 'tutor' );
24-
$form_class = isset( $form_class ) ? $form_class : '';
25-
$default_value = isset( $default_value ) ? $default_value : '';
26-
$submit_handler = isset( $submit_handler ) ? $submit_handler : '';
27-
$cancel_handler = isset( $cancel_handler ) ? $cancel_handler : '';
28-
$is_pending = isset( $is_pending ) ? $is_pending : '';
29-
$placeholder = isset( $placeholder ) ? $placeholder : __( 'Write your question', 'tutor' );
21+
$form_id = $form_id ?? '';
22+
$label = $label ?? '';
23+
$submit_label = $submit_label ?? __( 'Update', 'tutor' );
24+
$form_class = $form_class ?? '';
25+
$default_value = $default_value ?? '';
26+
$submit_handler = $submit_handler ?? '';
27+
$cancel_handler = $cancel_handler ?? '';
28+
$is_pending = $is_pending ?? '';
29+
$placeholder = $placeholder ?? __( 'Write your question', 'tutor' );
3030

3131
?>
3232

0 commit comments

Comments
 (0)