private function groupsArraySetting(array $groups, $id, array $config, $options = 0)
    {
        $groupsSettings = array();
        sort($groups);
        foreach ($groups as $group) {
            if (isset($config[$this->siteAccessNodeName][$group][$id])) {
                if ($options & static::MERGE_FROM_SECOND_LEVEL) {
                    foreach (array_keys($config[$this->siteAccessNodeName][$group][$id]) as $key) {
                        if (!isset($groupsSettings[$key])) {
                            $groupsSettings[$key] = $config[$this->siteAccessNodeName][$group][$id][$key];
                        } else {
                            // array_merge() has to be used because we don't
                            // know whether we have a hash or a plain array
                            $groupsSettings[$key] = array_merge(
                                $groupsSettings[$key],
                                $config[$this->siteAccessNodeName][$group][$id][$key]
                            );
                        }
                    }
                } else {
                    // array_merge() has to be used because we don't
                    // know whether we have a hash or a plain array
                    $groupsSettings = array_merge(
                        $groupsSettings,
                        $config[$this->siteAccessNodeName][$group][$id]
                    );
                }
            }
        }

        return $groupsSettings;
    }