Skip to content

Commit ee24899

Browse files
committed
Use null coalescing operator for cleaner input handling
1 parent 90745c0 commit ee24899

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

main/lp/lp_controller.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -600,19 +600,19 @@ function(reponse) {
600600
require 'lp_add_item.php';
601601
} else {
602602
Session::write('post_time', $_POST['post_time']);
603-
$directoryParentId = isset($_POST['directory_parent_id']) ? $_POST['directory_parent_id'] : 0;
603+
$directoryParentId = $_POST['directory_parent_id'] ?? 0;
604604
$courseInfo = api_get_course_info();
605605
if (empty($directoryParentId)) {
606606
$_SESSION['oLP']->generate_lp_folder($courseInfo);
607607
}
608608

609-
$parent = isset($_POST['parent']) ? $_POST['parent'] : '';
610-
$previous = isset($_POST['previous']) ? $_POST['previous'] : '';
611-
$type = isset($_POST['type']) ? $_POST['type'] : '';
612-
$path = isset($_POST['path']) ? $_POST['path'] : '';
613-
$description = isset($_POST['description']) ? $_POST['description'] : '';
614-
$prerequisites = isset($_POST['prerequisites']) ? $_POST['prerequisites'] : '';
615-
$maxTimeAllowed = isset($_POST['maxTimeAllowed']) ? $_POST['maxTimeAllowed'] : '';
609+
$parent = $_POST['parent'] ?? '';
610+
$previous = $_POST['previous'] ?? '';
611+
$type = $_POST['type'] ?? '';
612+
$path = $_POST['path'] ?? '';
613+
$description = $_POST['description'] ?? '';
614+
$prerequisites = $_POST['prerequisites'] ?? '';
615+
$maxTimeAllowed = $_POST['maxTimeAllowed'] ?? '';
616616

617617
if ($_POST['type'] == TOOL_DOCUMENT) {
618618

0 commit comments

Comments
 (0)