Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions system/Helpers/array_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,8 @@ function _array_search_dot(array $indexes, array $array)
$answer = array_filter($answer, static fn ($value) => $value !== null);

if ($answer !== []) {
if (count($answer) === 1) {
// If array only has one element, we return that element for BC.
return current($answer);
}

return $answer;
// If array only has one element, we return that element for BC.
return count($answer) === 1 ? current($answer) : $answer;
Comment thread
ddevsr marked this conversation as resolved.
}

return null;
Expand Down
8 changes: 1 addition & 7 deletions system/Helpers/form_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,7 @@ function set_radio(string $field, string $value = '', bool $default = false): st

$postInput = $request->getPost($field);

if ($oldInput !== null) {
$input = $oldInput;
} elseif ($postInput !== null) {
$input = $postInput;
} else {
$input = $default;
}
$input = $oldInput ?? $postInput ?? $default;
Comment thread
ddevsr marked this conversation as resolved.

if (is_array($input)) {
// Note: in_array('', array(0)) returns TRUE, do not use it
Expand Down
6 changes: 3 additions & 3 deletions system/Helpers/html_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ function _list(string $type = 'ul', $list = [], $attributes = '', int $depth = 0
$out .= $val;
} else {
$out .= $key
. "\n"
. _list($type, $val, '', $depth + 4)
. str_repeat(' ', $depth + 2);
. "\n"
. _list($type, $val, '', $depth + 4)
. str_repeat(' ', $depth + 2);
}

$out .= "</li>\n";
Expand Down