API::getSearchOptionUniqID PHP Method

getSearchOptionUniqID() private method

It permits to identify a searchoption with an named index instead a numeric one
private getSearchOptionUniqID ( $itemtype, $option = [] ) : string
$itemtype CommonDBTM current itemtype called on ressource listSearchOption
$option array current option to generate an unique id
return string the unique id
    private function getSearchOptionUniqID($itemtype, $option = array())
    {
        $uid_parts = array($itemtype);
        $sub_itemtype = getItemTypeForTable($option['table']);
        if ((isset($option['joinparams']['beforejoin']['table']) || empty($option['joinparams'])) && $option['linkfield'] != getForeignKeyFieldForItemType($sub_itemtype) && $option['linkfield'] != $option['field']) {
            $uid_parts[] = $option['linkfield'];
        }
        if (isset($option['joinparams'])) {
            if (isset($option['joinparams']['beforejoin'])) {
                $sub_parts = $this->getSearchOptionUniqIDJoins($option['joinparams']['beforejoin']);
                $uid_parts = array_merge($uid_parts, $sub_parts);
            }
        }
        if (isset($option['joinparams']['beforejoin']['table']) || $sub_itemtype != $itemtype) {
            $uid_parts[] = $sub_itemtype;
        }
        $uid_parts[] = $option['field'];
        $uuid = implode('.', $uid_parts);
        return $uuid;
    }