Source
xxxxxxxxxx
59
59
60
60
/**
61
61
* Get sub-groups of selected host groups or template groups.
62
62
*
63
63
* @param array $groupids
64
64
* @param array $ms_groups [OUT] The list of groups for multiselect.
65
65
* @param string $context Context of hosts or templates.
66
66
*
67
67
* @return array
68
68
*/
69
-
function getSubGroups(array $groupids, array &$ms_groups = null, string $context = 'host', array $options = []) {
69
+
function getSubGroups(array $groupids, ?array &$ms_groups = null, string $context = 'host', array $options = []) {
70
70
$entity = $context === 'host' ? API::HostGroup() : API::TemplateGroup();
71
71
$db_groups = $groupids
72
72
? $entity->get([
73
73
'output' => ['groupid', 'name'],
74
74
'groupids' => $groupids,
75
75
'preservekeys' => true
76
76
] + $options)
77
77
: [];
78
78
79
79
if ($ms_groups !== null) {
101
101
102
102
/**
103
103
* Get sub-groups of selected template groups.
104
104
*
105
105
* @param array $template_groupids
106
106
* @param array $ms_template_groups [OUT] The list of groups for multiselect.
107
107
* @param array $options Additional API options to select template groups.
108
108
*
109
109
* @return array
110
110
*/
111
-
function getTemplateSubGroups(array $template_groupids, array &$ms_template_groups = null, array $options = []) {
111
+
function getTemplateSubGroups(array $template_groupids, ?array &$ms_template_groups = null, array $options = []) {
112
112
$db_groups = $template_groupids
113
113
? API::TemplateGroup()->get([
114
114
'output' => ['groupid', 'name'],
115
115
'groupids' => $template_groupids,
116
116
'preservekeys' => true
117
117
] + $options)
118
118
: [];
119
119
120
120
if ($ms_template_groups !== null) {
121
121
$ms_template_groups = CArrayHelper::renameObjectsKeys($db_groups, ['groupid' => 'id']);