src/ViewCombination/InputScreenInformationBuilder.php
private function buildConditionTree(array $conditions): array
    {
        // Build condition tree.
        $conditionMap = [];
        $bySetting    = [];
        foreach ($conditions as $condition) {
            unset($converted);
            // Check if already mapped, if so, we need to set the values.
            if (array_key_exists($condition['id'], $conditionMap)) {
                $converted = &$conditionMap[$condition['id']];
                foreach ($condition as $key => $value) {
                    $converted[$key] = $value;
                }
            } else {
                $converted                      = \array_slice($condition, 0);
                $conditionMap[$condition['id']] = &$converted;
            }
            // Is on root level - add to setting now.
            if (empty($condition['pid'])) {
                $bySetting[$condition['settingId']][] = &$converted;
                continue;
            }
            // Is a child, check if parent already added.
            if (!isset($conditionMap[$condition['pid']])) {
                $temp                            = ['children' => []];
                $conditionMap[$condition['pid']] = &$temp;
            }
            // Add child to parent now.
            $conditionMap[$condition['pid']]['children'][] = &$converted;
        }

        return $bySetting;
    }
private function buildConditionTree(array $conditions): array
    {
        // Build condition tree.
        $conditionMap = [];
        $bySetting    = [];
        foreach ($conditions as $condition) {
            unset($converted);
            // Check if already mapped, if so, we need to set the values.
            if (array_key_exists($condition['id'], $conditionMap)) {
                $converted = &$conditionMap[$condition['id']];
                foreach ($condition as $key => $value) {
                    $converted[$key] = $value;
                }
            } else {
                $converted                      = \array_slice($condition, 0);
                $conditionMap[$condition['id']] = &$converted;
            }
            // Is on root level - add to setting now.
            if (empty($condition['pid'])) {
                $bySetting[$condition['settingId']][] = &$converted;
                continue;
            }
            // Is a child, check if parent already added.
            if (!isset($conditionMap[$condition['pid']])) {
                $temp                            = ['children' => []];
                $conditionMap[$condition['pid']] = &$temp;
            }
            // Add child to parent now.
            $conditionMap[$condition['pid']]['children'][] = &$converted;
        }

        return $bySetting;
    }
Build condition tree.

@param array $conditions The condition information.

@return array