It takes only the unique string names and sort using the order of appearance
@param string[] $names
@return bool true if the new names list is different from previous
481327
public function setOrder(array $names): bool
    {
        $order = array_flip($this->parseNames($names));
        if ($this->order === $order) {
            return false;
        }
        $this->order = $order;
        $this->count = count($order);
        return true;
    }
415198
protected function isConnectionForAllTablesTheSame(string ...$tableNames) : bool
    {
        /** @var ConnectionPool $connectionPool */
        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
        $connection = $connectionPool->getConnectionForTable(array_shift($tableNames));
        foreach ($tableNames as $tableName) {
            $connectionForTable = $connectionPool->getConnectionForTable($tableName);
            if ($connection !== $connectionForTable) {
                return false;
            }
        }
        return true;
    }
695553
public function defaults(string ...$names) : void
    {
        array_walk($names, function ($name) {
            if (!$this->hasOption($name)) {
                self::$options[] = $name;
            }
        });
    }
1028474
@Private static String[] sort(String... names) {
    //short name first, unless it is fully contained in a longer name
    String[] copy = names.clone();
    Arrays.sort(copy, LONGER_STRING_FIRST);
    Suites suites = new Suites();
    for (String name : copy) {
      suites.add(name);
    }
    return suites.toArray();
  }
713619
public static function getCodesByNames($names=array())
	{
		if (!($gdb = self::getGeoDBO()))
		{
			return array();
		}

		$names = array_map('strtolower', $names);
		foreach ($names as $k => $name)
		{
			$names[$k] = $gdb->quote($name);
		}

		$gdb->setQuery("SELECT DISTINCT name, code FROM countries WHERE LOWER(name) IN (" . implode(",", $names) . ")");
		$values = $gdb->loadAssocList('name');
		if (!is_array($values))
		{
			$values = array();
		}
		return $values;
	}
1215839
protected function hasMatchingSuffix(array $strings)
	{
		$suffix = end($strings[1]);
		foreach ($strings as $string)
		{
			if (end($string) !== $suffix)
			{
				return false;
			}
		}

		return ($suffix !== false);
	}
36839
public function controllerNameEquals($name) {
        $controllerName = strtolower($this->getControllerName());

        if (is_array($name)) {
            foreach ($name as $n) {
                if ($controllerName == strtolower($n)) {
                    return true;
                }
            }

            return false;
        }
        else {
            return $controllerName == strtolower($name);
        }
    }
1160710
public function getHeaderValues($names) {
        if (is_string($names))
            $names = array($names);
        elseif (is_array($names)) {
            foreach ($names as $name)
                if (!is_string($name)) throw new IllegalTypeException('Illegal argument type in argument $names: '.gettype($name));
        }
        else                         throw new IllegalTypeException('Illegal type of parameter $names: '.gettype($names));

        $headers = $this->getHeaders($names);
        if ($headers)
            return \array_map('trim', explode(',', join(',', $headers)));

        return $headers; // empty array;
    }
506563
public function loadOrCreateTags(array $names)
    {
        if (empty($names)) {
            return array();
        }

        $names = array_unique($names);

        $builder = $this->em->createQueryBuilder();

        $tags = $builder
            ->select('t')
            ->from($this->tagClass, 't')

            ->where($builder->expr()->in('t.name', $names))

            ->getQuery()
            ->getResult()
        ;

        $loadedNames = array();
        foreach ($tags as $tag) {
            $loadedNames[] = $tag->getName();
        }

        $missingNames = array_udiff($names, $loadedNames, 'strcasecmp');
        if (sizeof($missingNames)) {
            foreach ($missingNames as $name) {
                $tag = $this->createTag($name);
                $this->em->persist($tag);

                $tags[] = $tag;
            }

            $this->em->flush();
        }

        return $tags;
    }
72194
public static function isSent($name) {
	
		// remove [] from array
		if (substr($name, -2) == '[]') {
			$name = substr($name, 0, -2);
		}
		
		// seeking a possible name
		return (array_key_exists($name, $_REQUEST));
			
	}
484619
protected static function sortUnique($nodes) {
    $sort = [];
    $detached = [];
    foreach ($nodes as $node) {
      $key = $node->sortKey();
      if ($key[0] === '~') {
        $detached[] = $node;
      }
      else {
        $sort[$key] = $node;
      }
    }
    ksort($sort, SORT_NATURAL);
    return array_merge(array_values($sort), $detached);
  }
54163
public function hasTag($name)
    {
        foreach ($this->tags as $tag) {
            if (strtolower($tag->getName()) == $name) {
                return true;
            }
        }
        return false;
    }
877751
public function tablesExist($tableNames)
    {
        $tableNames = array_map('strtolower', (array) $tableNames);

        return count($tableNames) === count(array_intersect($tableNames, array_map('strtolower', $this->listTableNames())));
    }
1337664
protected function findOrCreateRolesByName($names)
    {
        if (empty($names)) {
            return [];
        }

        $existing = static::whereIn('name', $names)->get()->keyBy('name');

        return (new Collection($names))
                ->diff($existing->pluck('name'))
                ->map(function ($name) {
                    return static::create(compact('name'));
                })
                ->merge($existing);
    }
31359
public static function junctionTable($name, $tables)
    {
        sort($tables);
        $tables = implode('_', $tables);
        if ($name === $tables) {
            return true;
        }

        return false;
    }
696334
public function prune($name) {

        if ($this->name == $name) {
            return false;  //can not remove itself
        }

        foreach($this->children as $precedence => $child) {
            if ($child->name == $name) {
                // clear cache and delete self
                while($this->category_cache) {
                    // delete the cache, but keep the original array address
                    array_pop($this->category_cache);
                }
                unset($this->children[$precedence]);
                return true;
            } else if ($this->children[$precedence]->prune($name)) {
                return true;
            }
        }
        return false;
    }
1102051
public function hasTag(string $name): bool
    {
        /** @var Tag $tag */
        foreach ($this->getTags() as $tag) {
            if ($tag->getName() === $name) {
                return true;
            }
        }

        return false;
    }