Normalizes the tab configuration.
@param array $tabs a reference to the tabs tab configuration.
963514
protected function normalizeTabs($tabs)
    {
        $controller = $this->getController();
        if (isset($controller)) {
            foreach ($tabs as &$tabOptions) {
                $items = TbArray::getValue('items', $tabOptions, array());
                if (!empty($items)) {
                    $tabOptions['items'] = $this->normalizeTabs($items);
                } else {
                    if (isset($tabOptions['view'])) {
                        $view = TbArray::popValue('view', $tabOptions);
                        if ($controller->getViewFile($view) !== false) {
                            $tabOptions['content'] = $controller->renderPartial($view, $this->viewData, true);
                        }
                    }
                }
            }
        }
        return $tabs;
    }
494546
protected function normalizeQueryAttributes(array $attributes)
    {
        $result = [];

        foreach ($attributes as $attribute) {
            $result[] = $this->convertAttribute($attribute);
        }

        return $result;
    }
1218878
public function changeConfigs(array $configs)
    {
        foreach ($configs as $config) {
            $config = array_merge($this->defaultConfig, $config);          
            if ($this->isValidConfig($config)) {
                $this->changeConfig($config['path'], $config['value'], $config['scope_type'], $config['scope_code']);
            }
        }

        $this->cache->clean();
    }
307292
public function setAdapters($adapters)
    {
        $this->adapterClasses = [];
        $this->adapters = [];
        foreach ($adapters as $name => $adapter) {
            $this->setAdapter($name, $adapter);
        }
    }
235834
protected function normalizeFieldTypes(array &$fields)
    {
        foreach ($fields as $rkey => &$value) {
            $value['fieldname'] = $rkey;

            if ($value['type'] === 'select' && isset($value['multiple']) && $value['multiple'] === true) {
                $value['type'] = 'selectmultiple';
            }

            if (isset($this->typemap[$value['type']])) {
                $value['fieldtype'] = $this->typemap[$value['type']];
            } else {
                $value['fieldtype'] = $this->typemap['text'];
            }
        }
    }
143000
public function removeTab(Tab $tab)
    {
        if ($this->tabs->contains($tab)) {
            $this->tabs->remove($tab);
        }

        return $this;
    }
398974
protected function getTabPosition(array $tabs, $tabValue)
    {
        $position = 0;
        $ctr = 0;
        foreach($tabs as $keys => $values)
        {
            if($keys == $tabValue)
            {
                $position = $ctr;
            }
            $ctr++;
        }
        return $position;
    }
890170
public function normalize($widget): void
    {
        $contextAs = 'data';
        if (property_exists($widget, 'contextAs')) {
            // removes the $ sign.
            $contextAs = str_replace('$', '', (string) $widget->contextAs);
        }
        $widget->contextAs = $contextAs;
    }
551811
protected function normalizeHosts()
    {
        $connections = $this->config->get('database.redis-sentinel');

        if (! is_array($connections)) {
            return;
        }

        $this->config->set(
            'database.redis-sentinel',
            HostNormalizer::normalizeConnections($connections)
        );
    }
578930
public function setsTabs($tabs)
    {
        if (is_array($tabs)) {
            $tabs = new ArrayCollection($tabs);
        }
        if (!$tabs instanceof ArrayCollection) {
            throw new \UnexpectedValueException("Expected array or instance of " . ArrayCollection::class);
        }

        $this->tabs = $tabs;

        return $this;
    }
101640
protected function normalizeUserAttributes($attributes)
    {
        foreach ($this->getNormalizeUserAttributeMap() as $normalizedName => $actualName) {
            if (is_scalar($actualName)) {
                if (array_key_exists($actualName, $attributes)) {
                    $attributes[$normalizedName] = $attributes[$actualName];
                }
            } else {
                if (is_callable($actualName)) {
                    $attributes[$normalizedName] = call_user_func($actualName, $attributes);
                } elseif (is_array($actualName)) {
                    $haystack = $attributes;
                    $searchKeys = $actualName;
                    $isFound = true;
                    while (($key = array_shift($searchKeys)) !== null) {
                        if (is_array($haystack) && array_key_exists($key, $haystack)) {
                            $haystack = $haystack[$key];
                        } else {
                            $isFound = false;
                            break;
                        }
                    }
                    if ($isFound) {
                        $attributes[$normalizedName] = $haystack;
                    }
                } else {
                    throw new InvalidConfigException('Invalid actual name "' . gettype($actualName) . '" specified at "' . get_class($this) . '::normalizeUserAttributeMap"');
                }
            }
        }

        return $attributes;
    }
475305
public function setTables(array $tables)
    {
        $this->tables = array();

        foreach ($tables as $table) {
            $this->addTable($table);
        }
    }
636672
public function normalizeOptions(array $options)
    {
        $options['useSsl'] = (bool) ($options['useSsl'] == 'SSL');
        $options['useStartTls'] = (bool) ($options['useStartTls'] == 'TLS');
        $options['accountCanonicalForm'] = $this->accountCanonicalFormMap[ $options['accountCanonicalForm'] ];

        return $options;
    }
518904
private function normalizeArray(array &$data)
    {
        $normalizedData = array();

        foreach ($data as $key => $val) {
            $normalizedKey = $this->normalizeString($key);

            if ($normalizedKey !== $key) {
                if (array_key_exists($normalizedKey, $normalizedData)) {
                    throw new NormalizationException(sprintf(
                        'The key "%s" is invalid as it will override the existing key "%s"',
                        $key,
                        $normalizedKey
                    ));
                }
            }

            $normalizedData[$normalizedKey] = $val;
            $key = $normalizedKey;

            if (is_array($val)) {
                $this->normalizeArray($normalizedData[$key]);
            }
        }

        $data = $normalizedData;
    }
631350
protected function normalizeRelativePathAtoms(array $atoms)
    {
        $resultingAtoms = array();
        $resultingAtomsCount = 0;
        $numAtoms = count($atoms);

        for ($i = 0; $i < $numAtoms; $i++) {
            if (AbstractPath::SELF_ATOM !== $atoms[$i]) {
                $resultingAtoms[] = $atoms[$i];
                $resultingAtomsCount++;
            }

            if (
                $resultingAtomsCount > 1 &&
                AbstractPath::PARENT_ATOM === $resultingAtoms[$resultingAtomsCount - 1] &&
                AbstractPath::PARENT_ATOM !== $resultingAtoms[$resultingAtomsCount - 2]
            ) {
                array_splice($resultingAtoms, $resultingAtomsCount - 2, 2);
                $resultingAtomsCount -= 2;
            }
        }

        if (count($resultingAtoms) < 1) {
            $resultingAtoms = array(AbstractPath::SELF_ATOM);
        }

        return $resultingAtoms;
    }
361799
protected static function normalize(array $files)
    {
        $normalized = [];
        foreach ($files as $key => $value) {
            if ($value instanceof UploadedFileInterface) {
                $normalized[$key] = $value;

                continue;
            }

            if (! is_array($value)) {
                throw new InvalidArgumentException(
                    'Invalid value in files specification.'
                );
            }

            if (isset($value['tmp_name'])) {
                $normalized[$key] = static::build($value);

                continue;
            }

            $normalized[$key] = static::normalize($value);
        }

        return $normalized;
    }
806552
public void setTabs(ArrayList<String>tabs) {
        if (tabs == null || tabs.size() <= 0) return;

        if (platformSupportsTabs) {
            ArrayList<String> toAdd;
            if (tabs.size() > MAX_TABS) {
                toAdd = new ArrayList<>(tabs.subList(0, MAX_TABS));
            } else {
                toAdd = tabs;
            }
            this.tabs = toAdd.toArray(new String[0]);
        } else {
            Logger.d("Please upgrade com.android.support:design library to v28.0.0 to enable Tabs for App Inbox, dropping Tabs");
        }
    }