Ensure the list is case insensitively unique and that the authors are sorted.

@param string[]|null $authors The authors to work on.

@return string[] The filtered and sorted list.
963734
private function beautifyAuthorList($authors)
    {
        if ($authors === null) {
            return null;
        }

        $authors = \array_intersect_key($authors, \array_unique(\array_map('strtolower', $authors)));
        \usort($authors, 'strcasecmp');

        $mapped = [];
        foreach ($authors as $author) {
            $mapped[\strtolower($author)] = $author;
        }

        return $mapped;
    }
348438
protected function getStaticCredits()
    {
        $items = ArrayList::create();

        $authors = array_filter(preg_split('/\s*,\s*/', $this->AuthorNames));

        foreach ($authors as $author) {
            $item = ArrayData::create([
                'Name' => $author,
            ]);

            $items->push($item);
        }

        return $items;
    }
254359
private static CSLName[] toAuthors(List<Map<String, Object>> authors) {
		CSLName[] result = new CSLName[authors.size()];
		int i = 0;
		for (Map<String, Object> a : authors) {
			CSLNameBuilder builder = new CSLNameBuilder();
			if (a.containsKey(FIELD_FIRSTNAME)) {
				builder.given(strOrNull(a.get(FIELD_FIRSTNAME)));
			}
			if (a.containsKey(FIELD_LASTNAME)) {
				builder.family(strOrNull(a.get(FIELD_LASTNAME)));
			}
			builder.parseNames(true);
			result[i] = builder.build();
			++i;
		}
		return result;
	}
272362
public function get_author($key = 0)
	{
		$authors = $this->get_authors();
		if (isset($authors[$key]))
		{
			return $authors[$key];
		}
		else
		{
			return null;
		}
	}
9915
private function sortByPriorityAndFlatten(array $items)
    {
        if (!empty($items)) {
            \krsort($items);
            $items = \array_merge(...$items);
        }

        return $items;
    }
922859
public static function get_author( $author ) {
		if ( ! $author ) {
			return array();
		}
		$return = array_filter(
			array(
				'type'  => 'card',
				'name'  => $author->get_name(),
				'url'   => $author->get_link(),
				'email' => $author->get_email(),
			)
		);
		return $return;
	}
666247
public static function SetAuthors($authors)
    {
        self::CheckBackend();

        $authors = trim($authors);
        $authors = trim($authors, ",");

        self::$backend->Set("authors", $authors);
    }
576950
public function filterByPrimaryKeys($keys)
    {
        if (empty($keys)) {
            return $this->add(null, '1<>1', Criteria::CUSTOM);
        }
        foreach ($keys as $key) {
            $cton0 = $this->getNewCriterion(SkillGroupTableMap::COL_SKILL_ID, $key[0], Criteria::EQUAL);
            $cton1 = $this->getNewCriterion(SkillGroupTableMap::COL_GROUP_ID, $key[1], Criteria::EQUAL);
            $cton0->addAnd($cton1);
            $this->addOr($cton0);
        }

        return $this;
    }
1164996
public static function order(array &$values, array $keys) {
    $keys = array_values($keys);

    uksort($values, function ($a, $b) use ($keys) {
      return array_search($a, $keys) - array_search($b, $keys);
    });
  }
540629
private function filterHeaders(array $originalHeaders)
    {
        $headerNames = $headers = [];
        foreach ($originalHeaders as $header => $value) {
            if (! is_string($header)) {
                continue;
            }

            if (! is_array($value) && ! is_string($value)) {
                continue;
            }

            if (! is_array($value)) {
                $value = [ $value ];
            }

            $headerNames[strtolower($header)] = $header;
            $headers[$header] = $value;
        }

        return [ $headerNames, $headers ];
    }
581188
public function filterModifiedVariables(array $names)
    {
        $modifiedVariables = array();
        foreach ($names as $name) {
            if ($this->hasVariableBeenModified($name)) {
                $modifiedVariables[] = $name;
            }
        }

        return array_unique($modifiedVariables);
    }
1176292
def get_authors(self):
        
        if self._authors is None:
            # Sort messages with date first (by date ascending), and those
            # without a date last.
            msgs = sorted(self.get_messages().keys(),
                          key=lambda m: m.get_date() or datetime.max)

            orderby = settings.get('thread_authors_order_by')
            self._authors = []
            if orderby == 'latest_message':
                for m in msgs:
                    pair = m.get_author()
                    if pair in self._authors:
                        self._authors.remove(pair)
                    self._authors.append(pair)
            else:  # i.e. first_message
                for m in msgs:
                    pair = m.get_author()
                    if pair not in self._authors:
                        self._authors.append(pair)

        return self._authors
620100
public function Author()
    {
        if (!$this->owner->AuthorID) {
            return null;
        }
        /** @var Member $member */
        $member = DataObject::get_by_id(Member::class, $this->owner->AuthorID);
        return $member;
    }
1058218
protected static function sortApiVersions(array $versions = []): array
    {
        usort($versions, function ($first, $second) {
            $firstVersion = (float)$first['number'];
            $secondVersion = (float)$second['number'];

            if ($firstVersion == $secondVersion) {
                return 0;
            }

            return ($firstVersion > $secondVersion) ? 1 : -1;
        });

        return $versions;
    }
126067
public function checkInOrder(...$events): ?EventCollection
    {
        if (!count($events)) {
            return null;
        }

        $isMatch = true;
        $matchingEvents = [];
        $earliestEvent = null;

        foreach ($events as $event) {
            if ($event instanceof Event) {
                if (
                    !$earliestEvent ||
                    $event->sequenceNumber() > $earliestEvent->sequenceNumber()
                ) {
                    $matchingEvents[] = $earliestEvent = $event;

                    continue;
                }
            } elseif ($event instanceof EventCollection) {
                if (!$event->hasEvents()) {
                    throw new InvalidArgumentException(
                        'Cannot verify event order with empty results.'
                    );
                }

                foreach ($event->allEvents() as $subEvent) {
                    if (
                        !$earliestEvent ||
                        (
                            $subEvent->sequenceNumber() >
                            $earliestEvent->sequenceNumber()
                        )
                    ) {
                        $matchingEvents[] = $earliestEvent = $subEvent;

                        continue 2;
                    }
                }
            } else {
                throw new InvalidArgumentException(
                    sprintf(
                        'Cannot verify event order with supplied value %s.',
                        $this->assertionRenderer->renderValue($event)
                    )
                );
            }

            $isMatch = false;

            break;
        }

        if ($isMatch) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }

        return null;
    }
1200805
private function handleExtractors($extractors, AuthorExtractor $reference, AuthorListComparator $comparator)
    {
        $failed = false;

        foreach ($extractors as $extractor) {
            $failed = !$comparator->compare($extractor, $reference) || $failed;
        }

        return $failed;
    }
255034
public function to_legacy_objects(array $authors) : array {
        return array_map(function(author_entity $author) {
            return (object) [
                'id' => $author->get_id(),
                'picture' => $author->get_picture_item_id(),
                'firstname' => $author->get_first_name(),
                'lastname' => $author->get_last_name(),
                'fullname' => $author->get_full_name(),
                'email' => $author->get_email(),
                'middlename' => $author->get_middle_name(),
                'firstnamephonetic' => $author->get_first_name_phonetic(),
                'lastnamephonetic' => $author->get_last_name_phonetic(),
                'alternatename' => $author->get_alternate_name(),
                'imagealt' => $author->get_image_alt()
            ];
        }, $authors);
    }